-
Notifications
You must be signed in to change notification settings - Fork 39
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
"--import-mode=importlib" not working? #233
Comments
Thanks a lot @andioz for the feedback ! From the
I tried to modify the tests structure in your example to add There is a long thread of discussion here, maybe we'll find an answer here ? pytest-dev/pytest#7245 An important point is here: pytest-dev/pytest#7245 (comment)
I'll try that |
Yeah sure, I don't know where I've read about
This is a good resource I think. Of course |
Indeed, fair point. I confirm that Now can we do better ? Currently there are three places where using
All those behaviours could be removed (I guess) by any of the following :
I would be happy to hear about any solution to either of these, if anyone wishes to take a stab. Meanwhile, I leave this open as a "has_workaround" but do not add the "bug" label until this is the pytest default. Thanks again ! |
I'm not sure, but it looks like the |
Thanks for the hint ! Do pytest-flake8/coverage/pylint bring any additional value rather than using flake8/coverage/pylint ? I personally always use the latter, and it works fine. Of course other users might think differently, this is why it is definitely important to keep such a comment here.
I poked around and found out that maybe I could use |
Thank you for spending time on this! Like you, I run flake8/pylint without pytest plugins manually at the moment. Otherwise, I use the coverage plugin on a regular basis, especially with CI runner, this is a nice single command to get all information at once. |
Neat. I personally use I tried to implement the hack discussed above. It works, but uncovers another issue, that is more fundamental:
I therefore suggest to stop investigating for the moment, and wait until the landscape around the new import mechanisms in pytest gets a little clearer. |
Personally I think it would be nice to roll out the above 'hack' without supporting relative imports when using importlib import-mode. Maybe even raise an exception when one does try to use the unsupported combination, for now. |
Thanks @ThomasTNO for the feedback ! I do not have the bandwidth to propose such a feature, but would be happy to review a minimalistic PR that would
Let me know ! |
Hi,
I want to make my first steps with pytest-cases, but I'm stumbling immediately. I added a simple test using
@parametrize_with_cases
, but this fails withModuleNotFoundError
:The example project was extracted from my real project, including the
pytest.ini
file. After some time I recognized, theaddopts = --import-mode=importlib
line in the config causes the problem.Well, OK, one way would be to change this setting, but because I have an existing middle-sized project, I don't want to change settings without a detailed knowledge about all side-effects.
I wonder, is this
import-mode
not supported bypytest-cases
or am I missing some other required settings? I attach my sample project here.Many thanks!
pytest_cases_sample.zip
PS: quote from https://docs.pytest.org/en/6.2.x/pythonpath.html:
The text was updated successfully, but these errors were encountered: