Use importlib to avoid module name clashes for pytest#203
Use importlib to avoid module name clashes for pytest#203nicoddemus merged 2 commits intopytest-dev:masterfrom neumond:master
Conversation
regarding loading test modules with identical names
|
This is very useful! Any chances to get this merged? |
|
Moscow Python Beer Meetup report rules! |
|
This would be very helpful |
|
This is an amazing feature! |
|
@RonnyPfannschmidt |
|
this is a nice solution we can use as a temporary opt in, but im under the impression we are missing a deeper detail however i don't have time in the near future to work deeply enough into the related topic to make a good case for those details as such i believe a good way forward is to get this in, have it as opt-in in pytest an sort out the more detailed issues after the port to pathlib is complete |
|
We just need a CHANGELOG entry so we can merge this in. 👍 |
nicoddemus
left a comment
There was a problem hiding this comment.
Please update the CHANGELOG
|
🎉 |
|
Thanks again @neumond for the great PR! |
|
@neumond |
|
btw: would it still possible to support relative imports? ( |
|
Created pytest-dev/pytest#5352. |

This allows simple modification for pytest
--import-mode=importlibto completely avoid module naming issue if you have fresh python (>=3.5). This skips modifying sys.path, guessing package names, attempting to correctly import__init__.pyand directories. This is more than enough for usual pytest workflow, e.g. if you have unimportabletestsdirectory with files liketest_something.py.