Repository navigation
Description
Opening an issue to discuss how to handle the CI failures we've been having for a little while, that prevent tests from running on multiple platforms. I referenced this issue originally in #3876, and others have hit it too (e.g. #3898).
I tracked down the problem to two separate issues:
-
There is a piece of code in
run_tests.pythat inserts../build/lib.*insys.pathbefore running the tests. I assume this code is there to allow us running tests without doingpip install. Commenting this code lets the tests run successfully. -
With
python=3.7, we are running an old version ofpip/setuptoolsthat does not create abuild/folder in the repo root. As a result, because of (1) above, we only append the source directory (without the compiled code) to PYTHONPATH and so, any code that needs to import a compiled extension will fail. We can avoid the problem by adding--use-feature=in-tree-buildto the pip install command, which is the default behavior for recent versions of pip.
Now, why is this happening all of a sudden? The only thing I can point to is a version change in setuptools:
Downloading setuptools-62.0.0-py3-none-any.whl (1.1 MB)on April 8th.Downloading setuptools-62.1.0-py3-none-any.whl (1.1 MB)on April 11th.
I think the reason the Linux runners are not failing (on the main fork, they fail on my fork) is because of a cache issue and the linux-prep CI step.
From this "investigation", we have two options I believe. One is to drop the lines in run_tests.py, which I think we should. We should recommend people to use pip install -e . if they want to constantly monitor changes in the source, although I'm not sure that will work if you make changes to the C extensions. Then again, whoever edits those should know that there be dragons anyway 🐲 :) The second option is to add the --use-feature=in-tree-build to pip while we support python=3.7.
What are your thoughts? @mdehoon @peterjc
PS. We can also consider dropping run_tests.py altogether. I've been a happy user of pytest, which would require some, but not much, intervention to our tests to run since pytest is fully compatible with unittest. To mimic run_tests.py we'd need to add some tags to tests/modules we would like to skip (e.g. --offline option). Biggest advantage of this move would be concurrent test execution (specially on our local machines, since GHA is single-process).
Activity
mdehoon commentedon Apr 25, 2022
@JoaoRodrigues I don't have a strong opinion about this, so I'll let you and @peterjc decide.
peterjc commentedon Apr 25, 2022
That 'magic' in
run_tests.pyhas been there a very long time, and may have been specifically for the Martel C code (think super regular expressions) Biopython once used? Does anything obviously break for local use and testing if we drop those lines?I personally have been using
pip install -e .for some time, but rarely if ever touch the C code.(Looking at
pytestis also worth trying medium term, or sooner if someone has an itch to scratch)peterjc commentedon Apr 25, 2022
The timing does make setuptools look like the most likely cause.
JoaoRodrigues commentedon Apr 25, 2022
Thanks for the comments. As for removing the lines, nothing breaks as far as I see. I'll remove them on my test branch and let CI run to completion to make sure. I'll try running locally again too in a couple different ways. If that passes, I'll remove them and push.