python-phonenumbers icon indicating copy to clipboard operation
python-phonenumbers copied to clipboard

8.13.23: pytest cannot find any units

Open kloczek opened this issue 2 years ago • 1 comments

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 avatar Oct 17 '23 14:10 kloczek

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 =============================

kloczek avatar Oct 17 '23 14:10 kloczek