-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
AttributeError: 'Testdir' object has no attribute 'config' #8282
Comments
Hi @hroncok! It is "kinda" of a regression, albeit one can argue that API is a very subtle/unintentional one: pytest/src/_pytest/pytester.py Lines 1142 to 1143 in 09b1d7c
We can easily bring it back by using a read-only property to Perhaps we can change |
Hi @nicoddemus! Sure, we can fix pytest-ordering instead (however it appears quite silent recently, with active forks etc.), but I was not sure if this was intentional or not, that's why I asked first. The code is: @pytest.fixture
def item_names_for(testdir):
def _item_names_for(tests_content):
# some strange code to extract sorted items
items = testdir.getitems(tests_content)
hook = testdir.config.hook
hook.pytest_collection_modifyitems(session=items[0].session,
config=testdir.config, items=items)
return [item.name for item in items]
return _item_names_for What is the actual API to get the config/hook? |
, |
Hello. I've seen a problem when running tests of pytest-ordering.
The tests fails with:
It worked with pytest 6.0.2 but fails with 6.2.2. I cannot match a relevant changelog entry, and there was no deprecation warning in 6.0.
Reproducer:
This is on Linux, Fedora 33 and 34.
Is this a deliberate removal or a regression when Testdir become a wrapper around Pytester?
The text was updated successfully, but these errors were encountered: