Fixit icon indicating copy to clipboard operation
Fixit copied to clipboard

Drop use of libcst.testing.*

Open lpetre opened this issue 4 years ago • 2 comments

Summary

In order to upgrade pyre I'd like to stop using libcst.testing.utils.data_provider and use parameterized instead

The former attempts to typecheck the decorator input against the test method, but currently that is not possible in python's type system.

This is a large change w/ no functional difference. I used this codemod to convert all the tests: https://gist.github.com/lpetre/05b729a0891427c2a9def8d1eda3153d

I've changed from this:

from libcst.testing.utils import data_provider, UnitTest
class FooTest(UnitTest):
   @data_provider({"name": {"keyword": "value"}})
   def test(self, *, keyword: str) -> None:
      pass

To this equivalent in parameterized:

import unittest
from parameterized import param, parameterized
class FooTest(unittest.TestCase):
   @parameterized([param("name", **{"keyword": "value"})])
   def test(self, _name:str, keyword: str) -> None:
      pass

Test Plan

python -m unittest

lpetre avatar Nov 20 '21 13:11 lpetre

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@cebf376). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #207   +/-   ##
=======================================
  Coverage        ?   86.15%           
=======================================
  Files           ?       91           
  Lines           ?     3755           
  Branches        ?        0           
=======================================
  Hits            ?     3235           
  Misses          ?      520           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cebf376...e4a0570. Read the comment docs.

codecov-commenter avatar Nov 20 '21 13:11 codecov-commenter

Maybe add a type stub for parameterized, so pyre doesn't complain about a missing expand function?

zsol avatar Nov 20 '21 14:11 zsol

Hey there! We appreciate your contributions, but we're in the process of making some large changes to the core of Fixit. We will try to have more info about the direction we're heading soon, but in the mean time, we are closing all outstanding PR's from before we started this work. Thank you for your understanding.

amyreese avatar Oct 07 '22 01:10 amyreese