pylev icon indicating copy to clipboard operation
pylev copied to clipboard

1.4.0: pytest is failing

Open kloczek opened this issue 2 years ago • 0 comments

I know that you are using as test suite unittest istead pytest however corroctly written unittest based test suite should be working with pytest as well. On use pytest there are two issues:

  • pytest is not able find units because it scans by default tests_*py files only
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pylev-1.4.0-18.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pylev-1.4.0-18.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pylev-1.4.0
collected 0 items

=================================================================================== no tests ran in 0.01s ===================================================================================
  • on pass as param tests.py pytest fails in one unit
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pylev-1.4.0-18.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pylev-1.4.0-18.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' tests.py
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pylev-1.4.0
collected 23 items

tests.py ......................E                                                                                                                                                      [100%]

========================================================================================== ERRORS ===========================================================================================
_________________________________________________________________________________ ERROR at setup of test_fn _________________________________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/pylev-1.4.0/tests.py, line 32
      def _test_fn(self):
E       fixture 'self' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/home/tkloczko/rpmbuild/BUILD/pylev-1.4.0/tests.py:32
================================================================================== short test summary info ==================================================================================
ERROR tests.py::test_fn
================================================================================ 22 passed, 1 error in 0.05s ================================================================================

kloczek avatar Aug 11 '23 17:08 kloczek