Bump pytest version and add current directory to python path for reviewboard
Review Request #12289 — Created May 18, 2022 and submitted
Depending on the order in which Python packages are installed and added to the
Python Path, running unit tests usingpytest <args>
can be broken due to
pytest picking up the wrongtest.settings
module. For example instead of
picking up the Reviewboard test settings it could pick up the Django Evolution
or Djblets one. This can be fixed by forcing pytest to consider the current
directory in the Python search path. To do so 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 reviewboard
Summary | ID | Author |
---|---|---|
faf76bf921bf9e1f9e1a8e51e30736776f320e1f | Michelle |
Description | From | Last Updated |
---|---|---|
Let's repeat the problem first, and leave off the experience with this change. Since the cause is due to an … |
chipx86 |
- Description:
-
~ Bump pytest version and add current directory to python path for reviewboard
~ I didn't experience any problems with running unit tests using pytest but due to
+ the problems described in #12288, we are applying the same fixes here to prevent + those problems from happening here. - Testing Done:
-
~ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
~ I didn't experience any problems with running unit tests using pytest but due to the ~ Ran
./setup.py develop --all-pyvers
to ensure that pytest 7.1.2 was~ installed and successfully ran unit tests using pytest reviewboard
- problems described in #12288, we are applying the same fixes here to prevent those - problems from happening here.
- Description:
-
I didn't experience any problems with running unit tests using pytest but due to
~ the problems described in #12288, we are applying the same fixes here to prevent ~ the problems described in #12288, we are applying the same fixes here to prevent those problems from happening here.
-
-
Let's repeat the problem first, and leave off the experience with this change. Since the cause is due to an installation order issue, it could in theory happen with any of them.
Generally-speaking, we aim to have each description/commit message stand on its own, rather than needing to refer to another (particularly in another codebase) for the context.
- Description:
-
~ I didn't experience any problems with running unit tests using pytest but due to
~ the problems described in #12288, we are applying the same fixes here to prevent ~ those problems from happening here. ~ Depending on the order in which Python packages are installed and added to the
~ Python Path, running unit tests using pytest <args>
can be broken due to~ pytest picking up the wrong test.settings
module. For example instead of+ picking up the Reviewboard test settings it could pick up the Django Evolution + or Djblets one. This can be fixed by forcing pytest to consider the current + directory in the Python search path. To do so we update our pytest to the latest + version (any version >7 works) and set pytest's pythonpath
config variable to+ include the current directory.