Skip to content

Subclassing _pytest.Testdir does not work anymore. #17

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

Closed
bnavigator opened this issue Feb 23, 2021 · 1 comment
Closed

Subclassing _pytest.Testdir does not work anymore. #17

bnavigator opened this issue Feb 23, 2021 · 1 comment

Comments

@bnavigator
Copy link

All tests using the mpi_testdir fixture fail with pytest 6.2:

[    3s] _____________________ ERROR at setup of test_mpi_file_name _____________________
[    3s] 
[    3s] request = <SubRequest 'mpi_testdir' for <Function test_mpi_file_name>>
[    3s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f0bad081b38>, _basetemp=None))
[    3s] 
[    3s]     @pytest.fixture
[    3s]     def mpi_testdir(request, tmpdir_factory):
[    3s] >       return MPITestdir(request, tmpdir_factory)
[    3s] 
[    3s] tests/conftest.py:57: 
[    3s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[    3s] 
[    3s] self = <[AttributeError("'MPITestdir' object has no attribute '_pytester'",) raised in repr()] MPITestdir object at 0x7f0bacfad0f0>
[    3s] request = <SubRequest 'mpi_testdir' for <Function test_mpi_file_name>>
[    3s] tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f0bad081b38>, _basetemp=None))
[    3s] 
[    3s]     def __init__(self, request, tmpdir_factory):
[    3s] >       super().__init__(request, tmpdir_factory)
[    3s] E       TypeError: __init__() takes 2 positional arguments but 3 were given
[    3s] 
[    3s] tests/conftest.py:22: TypeError

Pytest really does not want downstream projects to subclass Testdir:
pytest-dev/pytest#8017, pytest-dev/pytest@f1e6fdc

@aragilar
Copy link
Owner

Fixed in #28.

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