wolever/parameterized

Support pytest7

musicinmybrain opened this issue · 4 comments

The current version 0.9.0 does not work with the current version of pytest (7.3.1), which is a problem in cases such as Linux distributions where only the latest version of pytest is available.

Prior to 0.9.0, the patch described in #116 (comment) was viable, but it seems like things may have diverged too much since then.

Working on the current master, b9f6a64, without any patches, I tried enabling the tests in tox.ini as follows:

diff --git a/tox.ini b/tox.ini
index f109b95..9682e27 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 # NOTE: when adding Python versions, also update and re-run `./rebuild-circleci-yaml`
-envlist=pypy3-{nose,nose2,pytest3,unit,unit2},py{37,38,39}-{nose,nose2,pytest3,unit,unit2},py{310,311}-{unit,nose2}
+envlist=pypy3-{nose,nose2,pytest3,pytest7,unit,unit2},py{37,38,39}-{nose,nose2,pytest3,pytest7,unit,unit2},py{310,311}-{unit,nose2}
 
 [testenv]
 deps=
@@ -10,6 +10,7 @@ deps=
     pytest2: pytest>=2,<3
     pytest3: pytest>=3,<4
     #pytest4: pytest>=4,<5
+    pytest7: pytest>=7,<8
     unit2: unittest2
 commands=
     nose: nosetests
@@ -17,5 +18,6 @@ commands=
     pytest2: py.test parameterized/test.py
     pytest3: py.test parameterized/test.py
     #pytest4: py.test parameterized/test.py
+    pytest7: py.test parameterized/test.py
     unit: python -m unittest parameterized.test
-    unit2: unit2 parameterized.test
\ No newline at end of file
+    unit2: unit2 parameterized.test

When I run one of the resulting environments I get an error, e.g.:

$ python -m tox -e py311-pytest7
...
collected 73 items                                                             

parameterized/test.py xx......x........xx..x.......................x.s.. [ 68%]
xxxx...................E                                                 [100%]

==================================== ERRORS ====================================
_ ERROR at teardown of TestAsyncParameterizedExpandWithNoMockPatchForClass.test_one_async_function_patch_decorator_2_foo1 _

    def tearDownModule():
        missing = sorted(list(missing_tests))
>       assert_equal(missing, [])
E       AssertionError: Lists differ: ["test_instance_method('foo0', bar=None)",[683 chars]o')"] != []
E       
E       First list contains 17 additional elements.
E       First extra element 0:
E       "test_instance_method('foo0', bar=None)"
E       
E       Diff is 786 characters long. Set self.maxDiff to None to see it.

parameterized/test.py:489: AssertionError
...

Is there any chance of making this work in the relatively near future? Thanks!

If I simply comment out the failing assertion in tearDownModule, the rest of the tests pass, and the packages that use parameterized in Fedora still build from source. I haven’t attempted to figure out why that assertion is failing, though.

mcepl commented

Actually, whole idea of assert in tearDown method seems a bit suspicious to me.