Bump pytest version and add current directory to python path
Review Request #12288 — Created May 18, 2022 and submitted
Running unit tests using
pytest <args>
was broken because pytest was importing
test.settings
from Django Evolution instead of from Djblets. This happened
because pytest does not add the current directory to the Python Path, so
depending on the order in which Django Evolution and Djblets were installed and
registered in the Python Path, the wrongtest.settings
module could be picked
up. To fix this we update our pytest to the latest version (any version >7
works) and set pytest'spythonpath
config variable to include the current
directory.
Ran
./setup.py develop --all-pyvers
to ensure that pytest 7.1.2 was
installed and successfully ran unit tests usingpytest djblets/forms/tests
Summary | ID | Author |
---|---|---|
d751f691848093758aea227a8c48460ddcb05b76 | Michelle |
Description | From | Last Updated |
---|---|---|
To be more specific as to the cause, depending on the order in which Django Evolution and Djblets were installed … |
chipx86 | |
Small nits in the description: "python" -> "Python" "djblets" -> "Djblets" "django-evolution" -> "Django Evolution" And let's use backticks around … |
chipx86 |
-
-
To be more specific as to the cause, depending on the order in which Django Evolution and Djblets were installed and registered in the Python Path, the wrong
test.settings
module could be picked up. That'll be an important part of the reason for this issue. -
Small nits in the description:
"python" -> "Python"
"djblets" -> "Djblets"
"django-evolution" -> "Django Evolution"And let's use backticks around
pythonpath
, as it's a configuration entry and not a term.
- Description:
-
Running unit tests using
pytest <args>
was broken because pytest was importing~ tests/settings.py
from django-evolution instead of from djblets. This happened~ because pytest doesn't add the current directory to the python search path. ~ To fix this we update our pytest to the latest version (any version >7 works) ~ and set pytest's pythonpath config variable to include the current directory. ~ test.settings
from Django Evolution instead of from Djblets. This happened~ because pytest does not add the current directory to the Python Path, so ~ depending on the order in which Django Evolution and Djblets were installed and ~ registered in the Python Path, the wrong test.settings
module could be picked+ up. To fix this we update our pytest to the latest version (any version >7 + works) and set pytest's pythonpath
config variable to include the current+ directory.