jmespath/jmespath.py

0.10.0: test suite uses `nose` module which is outdated

kloczek opened this issue · 3 comments

nose module is for python 2.x https://nose.readthedocs.io/en/latest/ and that module is no longer maintained.

+ /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=1145380998
rootdir: /home/tkloczko/rpmbuild/BUILD/jmespath.py-0.10.0
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 74 items / 2 errors / 72 selected

================================================================================== ERRORS ==================================================================================
________________________________________________________________ ERROR collecting extra/test_hypothesis.py _________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/jmespath.py-0.10.0/extra/test_hypothesis.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)
extra/test_hypothesis.py:9: in <module>
    from nose.plugins.skip import SkipTest
E   ModuleNotFoundError: No module named 'nose'
________________________________________________________________ ERROR collecting tests/test_compliance.py _________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/jmespath.py-0.10.0/tests/test_compliance.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)
tests/test_compliance.py:6: in <module>
    from nose.tools import assert_equal
E   ModuleNotFoundError: No module named 'nose'
========================================================================= short test summary info ==========================================================================
ERROR extra/test_hypothesis.py
ERROR tests/test_compliance.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 2 errors in 0.43s =============================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.

And nose doesn't work on Python 3.10:

$ python3.9 -m nose
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S..
----------------------------------------------------------------------
Ran 969 tests in 1.078s

OK (SKIP=1)
$ python3.10 -m nose
Traceback (most recent call last):
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/__main__.py", line 8, in <module>
    run_exit()
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/core.py", line 179, in parseArgs
    self.createTests()
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/core.py", line 193, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames)
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/loader.py", line 481, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/loader.py", line 454, in loadTestsFromName
    return LazySuite(
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/suite.py", line 53, in __init__
    super(LazySuite, self).__init__()
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/unittest/suite.py", line 22, in __init__
    self._tests = []
  File "/Users/hugo/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/nose/suite.py", line 106, in _set_tests
    if isinstance(tests, collections.Callable) and not is_suite:
AttributeError: module 'collections' has no attribute 'Callable'

Switched to pytest in #271

Still one file uses nose

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-jmespath-1.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-jmespath-1.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-7.1.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/jmespath.py-1.0.0
collected 969 items / 1 error

================================================================================== ERRORS ==================================================================================
________________________________________________________________ ERROR collecting extra/test_hypothesis.py _________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/jmespath.py-1.0.0/extra/test_hypothesis.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)
extra/test_hypothesis.py:9: in <module>
    from nose.plugins.skip import SkipTest
E   ModuleNotFoundError: No module named 'nose'
========================================================================= short test summary info ==========================================================================
ERROR extra/test_hypothesis.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.27s =============================================================================

Additionally after add that file sto ignore list pytest shows one warning

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-jmespath-1.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-jmespath-1.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --ignore extra/test_hypothesis.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-7.1.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/jmespath.py-1.0.0
collected 969 items

tests/test_compliance.py ........................................................................................................................................... [ 14%]
.................................................................................................................................................................... [ 31%]
.................................................................................................................................................................... [ 48%]
.................................................................................................................................................................... [ 65%]
.................................................................................................................................................................... [ 82%]
......................................................................................................                                                               [ 92%]
tests/test_custom_functions.py .                                                                                                                                     [ 92%]
tests/test_functions.py .....                                                                                                                                        [ 93%]
tests/test_lexer.py ...................                                                                                                                              [ 95%]
tests/test_parser.py ..........................................                                                                                                      [ 99%]
tests/test_search.py ....s                                                                                                                                           [100%]

============================================================================= warnings summary =============================================================================
tests/test_compliance.py: 14 warnings
tests/test_lexer.py: 3 warnings
  /home/tkloczko/rpmbuild/BUILD/jmespath.py-1.0.0/jmespath/lexer.py:169: PendingDeprecationWarning: deprecated string literal syntax
    warnings.warn("deprecated string literal syntax",

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_search.py:55: Test requires long() type
=============================================================== 968 passed, 1 skipped, 17 warnings in 2.02s ================================================================