4.0.7: test suuite uses `nose` module
kloczek opened this issue · 2 comments
nose is for python 2.x and should be replaced by pytest, nose2 or unittest2
https://docs.nose2.io/en/latest/differences.html
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-gitdb-4.0.7-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-gitdb-4.0.7-2.1.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=1481814927
rootdir: /home/tkloczko/rpmbuild/BUILD/gitdb-4.0.7
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0
collected 20 items / 2 errors / 18 selected
================================================================================== ERRORS ==================================================================================
_________________________________________________________________ ERROR collecting gitdb/test/test_pack.py _________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/gitdb-4.0.7/gitdb/test/test_pack.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
gitdb/test/test_pack.py:29: in <module>
from nose import SkipTest
E ModuleNotFoundError: No module named 'nose'
_______________________________________________________________ ERROR collecting gitdb/test/db/test_pack.py ________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/gitdb-4.0.7/gitdb/test/db/test_pack.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
gitdb/test/db/test_pack.py:19: in <module>
from nose.plugins.skip import SkipTest
E ModuleNotFoundError: No module named 'nose'
========================================================================= short test summary info ==========================================================================
ERROR gitdb/test/test_pack.py
ERROR gitdb/test/db/test_pack.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 2 errors in 0.56s =============================================================================Definitely! This work was already performed in the parent project, and would need a volunteer for it to take place here as well.
In GitPython, it worked without any hassle as I have been told.
noseis for python 2.x
Nose runs on Python 3 just fine - but it should be replaced for other reasons (namely, being dead).
Note that pytest supports running nose-style tests - from a very quick try, that includes gitdb's:
============================= test session starts ==============================
platform linux -- Python 3.10.1, pytest-6.2.5, py-1.11.0, pluggy-0.13.1
rootdir: /home/florian/tmp/gitdb
plugins: hypothesis-6.17.0, anyio-3.4.0
collected 24 items
gitdb/test/test_base.py . [ 4%]
gitdb/test/test_example.py . [ 8%]
gitdb/test/test_pack.py .s.. [ 25%]
gitdb/test/test_stream.py .... [ 41%]
gitdb/test/test_util.py .. [ 50%]
gitdb/test/db/test_git.py .. [ 58%]
gitdb/test/db/test_loose.py . [ 62%]
gitdb/test/db/test_mem.py . [ 66%]
gitdb/test/db/test_pack.py . [ 70%]
gitdb/test/db/test_ref.py . [ 75%]
gitdb/test/performance/test_pack.py ... [ 87%]
gitdb/test/performance/test_pack_streaming.py .. [ 95%]
gitdb/test/performance/test_stream.py . [100%]
=============================== warnings summary ===============================
../../../../usr/lib/python3.10/site-packages/packaging/version.py:127: 2850 warnings
/usr/lib/python3.10/site-packages/packaging/version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release
warnings.warn(
../../../../usr/lib/python3.10/site-packages/nose/importer.py:12
/usr/lib/python3.10/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
from imp import find_module, load_module, acquire_lock, release_lock
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================ 23 passed, 1 skipped, 2851 warnings in 15.47s =================
I'd still recommend rewriting the tests themselves (perhaps via nose2pytest), but that can be a more gradual process too. As for the warnings, those are coming from nose importing pkg_resources on my system - YMMV, and you could ignore them.