Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pytest7 #167

Open
musicinmybrain opened this issue Apr 15, 2023 · 2 comments
Open

Support pytest7 #167

musicinmybrain opened this issue Apr 15, 2023 · 2 comments

Comments

@musicinmybrain
Copy link
Contributor

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!

@musicinmybrain
Copy link
Contributor Author

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
Copy link

mcepl commented May 12, 2023

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

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue May 13, 2023
https://build.opensuse.org/request/show/1086781
by user mcepl + dimstar_suse
- Update to 0.9.0:
  - Drop support for Python 2.X, 3.5, and 3.6;
    Add support for Python 3.10, 3.11
  - Modernize from setup.py -> pyproject.toml
  - Add ``namespace`` argument to ``@parameterize.expand``
  - Add support for ``IsolatedAsyncioTestCase``
  - Work around for bug bpo-40126 in older versions of ``mock``
  - Allow str, bytes, and any non-iterable input to be passed to
    ``@parameterized`` without wrapping in a tuple
  - Fix class-level ``mock.patch.multiple``
- Add skip_failing_teardown.patch (gh#wolever/parameterized#167)
  to overcome failing tearDownModule().
- Remove upstreamed parameterized-pr116-pytest4.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants