Skip to content
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

Pytest picking up tests in wrong location? #7293

Closed
3 tasks done
LiterallyUniqueLogin opened this issue Jun 1, 2020 · 6 comments
Closed
3 tasks done

Pytest picking up tests in wrong location? #7293

LiterallyUniqueLogin opened this issue Jun 1, 2020 · 6 comments
Labels
topic: collection related to the collection phase type: bug problem that needs to be addressed

Comments

@LiterallyUniqueLogin
Copy link

LiterallyUniqueLogin commented Jun 1, 2020

  • a detailed description of the bug or suggestion

I have two copies of a package on my computer: one which is installed (at /storage/conda/lib/python3.7/site-packages/trtools) and one which has been cloned from git (at /tmp/trtools_data_download/trtools). I'm doing this because I want to test the installed package but some of the test data only exists in the repo and not in the installation.

I want to test the installed package with pytest, but when I run it it is picking up the python test files from the cloned git repo and not the installation, even though I've cd'd to the root of the installation. Any idea why this is happening?

Here is the relevant output. Note the location of test_compareSTR.py file that is being run is not the copy in my current subdirectory.

The --datadir argument is something my tests pick up via the instructions here. It's the only thing I can think of that could be mucking with test discovery. But I don't see how it would do that.

(temp_pip_install) $ ls /storage/conda/lib/python3.7/site-packages/trtools/compareSTR/tests/
__init__.py  __pycache__  test_compareSTR.py
(temp_pip_install) $ pwd
/storage/conda/lib/python3.7/site-packages/trtools
(temp_pip_install) $ python -m pytest . -p trtools.testsupport.dataloader --datadir /tmp/trtools_data_download/trtools/testsupport
========================================== test session starts ==========================================
platform linux -- Python 3.7.6, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
rootdir: /tmp/trtools_data_download, inifile: pytest.ini
collected 72 items

../../../../../../../tmp/trtools_data_download/compareSTR/tests/test_compareSTR.py ..             [  2%]
  • output of pip list from the virtual environment you are using
(temp_pip_install) $ pip list
Package                Version
---------------------- -------------------
attrs                  19.3.0
certifi                2020.4.5.1
cffi                   1.14.0
chardet                3.0.4
conda                  4.8.3
conda-package-handling 1.7.0
cryptography           2.9.2
cycler                 0.10.0
idna                   2.9
importlib-metadata     1.6.0
kiwisolver             1.2.0
matplotlib             3.2.1
more-itertools         8.3.0
numpy                  1.18.4
packaging              20.4
pandas                 1.0.4
pip                    20.0.2pluggy                 0.13.1
py                     1.8.1
pybedtools             0.8.1
pycosat                0.6.3
pycparser              2.20
pyOpenSSL              19.1.0
pyparsing              2.4.7
pysam                  0.15.4
PySocks                1.7.1
pytest                 5.4.2
python-dateutil        2.8.1
pytz                   2020.1
PyVCF                  0.6.8
requests               2.23.0
ruamel-yaml            0.15.87
scipy                  1.4.1
setuptools             46.4.0.post20200518
six                    1.14.0
tqdm                   4.46.0
trtools                2.0.18
urllib3                1.25.8
wcwidth                0.1.9
wheel                  0.34.2
zipp                   3.1.0
  • pytest and operating system versions
(temp_pip_install) $ pytest --version
This is pytest version 5.4.2, imported from /storage/conda/lib/python3.7/site-packages/pytest/__init__.py
(temp_pip_install) $ cat /etc/os-releaseNAME="CentOS Linux"VERSION="7 (Core)"ID="centos"ID_LIKE="rhel fedora"

Thanks for the help!

@Zac-HD Zac-HD added topic: collection related to the collection phase type: question general question, might be closed after 2 weeks of inactivity labels Jun 2, 2020
@RonnyPfannschmidt
Copy link
Member

this is a bug as pytest suport for packages is second class, and the insertion of the path in the arguments messes with the combination of the test folder finding

@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed and removed type: question general question, might be closed after 2 weeks of inactivity labels Jun 2, 2020
@gdhameeja
Copy link
Contributor

I'd like to work on this.

@nicoddemus
Copy link
Member

@RonnyPfannschmidt perhaps this was fixed in #7040?

@RonnyPfannschmidt
Copy link
Member

Seems possible, but we have validate

@nicoddemus
Copy link
Member

@LiterallyUniqueLogin is it possible for you to test that with the latest master? Or provide a minimal reproducible example so we can try it out?

@bluetech
Copy link
Member

Closing per above.

@bluetech bluetech closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: collection related to the collection phase type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

6 participants