Closed neumond closed 5 years ago
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!
I've made additional checks to prove these changes actually work with pytest.
As expected, it requires only adding "importlib"
to --import-mode
choices.
@RonnyPfannschmidt What is your opinion on this?
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. 👍
Let's wait a day or two to get #207 and #215 in the next release as well. 👍
:tada: Thank you all!
Thanks again @neumond for the great PR!
@neumond Do you plan adding creating a PR to add this to pytest (choices/help, doc)? (just stumbled across via py's docstring)
btw: would it still possible to support relative imports? (ImportError: attempted relative import with no known parent package
)
This allows simple modification for pytest
--import-mode=importlib
to 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__.py
and directories. This is more than enough for usual pytest workflow, e.g. if you have unimportabletests
directory with files liketest_something.py
.