-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[prerelease] AttributeError: module 'homeassistant.setup' has no attribute '__code__' #9391
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
Comments
Thanks for bisecting. That commit is a bugfix I'd say. I've noticed it while considering deprecating the nose compat however I decided against it for now as it would be useless churn for users. homeassistent should either avoid these names, or probably better, disable the nose plugin ( |
Fair, but I wonder if we could/should show a better message for that case? |
Wow, thanks for the effort. |
Better error would be good (also relevant for pytest own names e.g. |
@cgtobi thanks for testing the rc 😀 |
I just took a quick look at this with @cgtobi - Home Assistant actually uses nose-style I was wondering why this worked just fine for them despite the I think the reason is that before, we used However, with #9273, we now call it unconditionally despite it being a module object, which then results in the Despite surely being a bit unorthodox in moduleassistant's code, I think this is a regression. Not sure what the best behavior here would be:
|
I vote for this, pytest should be "smart" here and figure out that an object is not callable. Not sure 2) would help users, other than forcing them to rename a module ( |
Btw thanks for the report @cgtobi and for the investigation @The-Compiler! |
Since commit 89f0b5b cases as in the added test started to fail, like they do for the standard pytest names (`setup_module` etc). But the name `setup` in particular is way too common for us to start taking it over more aggressively, so restore the previous behavior which required the object to be callable. Fix pytest-dev#9391.
Uh oh!
There was an error while loading. Please reload this page.
Via Twitter, @cgtobi reports:
And indeed I can reproduce the failure via
tox -e py39 -- -x tests/test_setup.py
in the home-assistant/core repository (after sneaking in the pytest main branch via pip once the initial run passed - note that it will needtox-pip-version
and setting things up will take quite a while):Relevant code here: https://github.com/home-assistant/core/blob/dev/tests/test_setup.py
I was able to bisect this to 89f0b5b, which is:
nose: fix class- and module-level fixture behavior by bluetech · Pull Request #9273 · pytest-dev/pytest
I suspect the
from homeassistant import config_entries, setup
results in asetup
name inside the test module, which pytest now picks up as a nose-style setup function but did not before or something?cc @bluetech
The text was updated successfully, but these errors were encountered: