-
-
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
AssertionError triggered by pytest --override-ini='pythonpath=foo'
#11311
Comments
Thanks for the report. ProblemThis happens because:
Possible solutionsOption 1: raise an error in case of trying to use a Option 1': same as 1 but only for relative paths, so absolute paths are OK. Option 2: use some other path instead if the inipath is not defined, most likely the current working directory/invocation path. Since this basically can only happen when using |
I see: I made the wrong assumption that So I would suggest option 1 in order to enforce the override ini meaning of Brief explanation of the cognitive pitfallProbably I didn't read the docs with sufficent attention, but my error here was to assume that every variable in the pytest configuration options has a default value, and thus can be overridden. But when a config file is missing, some variables are undefined, and there is no meaningful way to override them. Another not so easy fact to undestand was that a As what regards option 2, I would therefore suggest to consider also the directory containing |
This is actually a good point, because |
…e found Today `pyproject.toml` is the standard for declaring a Python project root, so seems reasonable to consider it for the ini configuration (and specially `rootdir`) in case we do not find other suitable candidates. Related to pytest-dev#11311
…-file Previously this would trigger an `AssertionError`. While it could be considered a bug-fix, but given it now can be relied upon, it is probably better to consider it an improvement. Fix pytest-dev#11311
…-file Previously this would trigger an `AssertionError`. While it could be considered a bug-fix, but given it now can be relied upon, it is probably better to consider it an improvement. Fix pytest-dev#11311
…-file (pytest-dev#11963) Previously this would trigger an `AssertionError`. While it could be considered a bug-fix, but given it now can be relied upon, it is probably better to consider it an improvement. Fix pytest-dev#11311
…e found (pytest-dev#11962) Today `pyproject.toml` is the standard for declaring a Python project root, so seems reasonable to consider it for the ini configuration (and specially `rootdir`) in case we do not find other suitable candidates. Related to pytest-dev#11311
Description
The option
--override-ini='pythonpath=foo'
may trigger anAssertionError
.Minimal example
Running
pytest --override-ini='pythonpath=foo'
in an empty directory fails withOutput of
pip list
and enviornmentRun on
macOS-13.2.1-x86_64-i386-64bit
, but same problem also on linux.Context
I stumbled in this error while building a python package for Arch: instead of using
I tried
which fails with the above traceback.
I replicated the problem on a MacOs stripped down venv just to be sure that it is not related to the ArchLinux build env, which is quite complicated.
The text was updated successfully, but these errors were encountered: