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

8.13.23: pytest cannot find any units #284

Open
kloczek opened this issue Oct 17, 2023 · 1 comment
Open

8.13.23: pytest cannot find any units #284

kloczek opened this issue Oct 17, 2023 · 1 comment

Comments

@kloczek
Copy link

kloczek commented Oct 17, 2023

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using 'installer` module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Looks like pytest cannot find any units because it scans only tests_*.py files and all files in tests/ are not with such names.

Here is pytest output:

+ cd python-phonenumbers-8.13.23
+ cd python
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-phonenumbers-8.13.23-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-phonenumbers-8.13.23-2.fc
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-phonenumbers-8.13.23/python
collected 0 items

============================ no tests ran in 0.14s =============================
@kloczek
Copy link
Author

kloczek commented Oct 17, 2023

After passing tests/*py as param looks like everything is fine so to make test suite pytest redy it is necessary only rename files in tests/

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-phonenumbers-8.13.23-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-phonenumbers-8.13.23-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' tests/__init__.py tests/asyoutypetest.py tests/carriertest.py tests/examplenumberstest.py tests/geocodertest.py tests/phonenumbermatchertest.py tests/phonenumbertest.py tests/phonenumberutiltest.py tests/shortnumberinfotest.py tests/testmetadatatest.py tests/timezonetest.py
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-phonenumbers-8.13.23/python
collected 338 items

tests/asyoutypetest.py ................................................. [ 10%]
.....................                                                    [ 10%]
tests/carriertest.py ........                                            [ 12%]
tests/examplenumberstest.py ...........................                  [ 20%]
tests/geocodertest.py ...........                                        [ 23%]
tests/phonenumbermatchertest.py ........................................ [ 35%]
..........                                                               [ 38%]
tests/phonenumbertest.py ..........                                      [ 41%]
tests/phonenumberutiltest.py ........................................... [ 54%]
........................................................................ [ 75%]
...............                                                          [ 80%]
tests/shortnumberinfotest.py .............................               [ 88%]
tests/timezonetest.py ...

============================= 338 passed in 13.80s =============================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants