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

make test doesn't work #530

Closed
davidwagner opened this issue Apr 8, 2022 · 1 comment · Fixed by #534
Closed

make test doesn't work #530

davidwagner opened this issue Apr 8, 2022 · 1 comment · Fixed by #534

Comments

@davidwagner
Copy link
Member

make test no longer works. It gives the following error on my machine:

python3 tests.py
Traceback (most recent call last):
  File "/home/daw/datascience/datascience/tests.py", line 5, in <module>
    sys.exit(pytest.main(['--nbval-lax', '--cov=datascience', 'tests']))
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/config/__init__.py", line 136, in main
    config = _prepareconfig(args, plugins)
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/config/__init__.py", line 313, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/helpconfig.py", line 99, in pytest_cmdline_parse
    config = outcome.get_result()  # type: Config
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/config/__init__.py", line 932, in pytest_cmdline_parse
    self.parse(args)
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/config/__init__.py", line 1204, in parse
    self._preparse(args, addopts=addopts)
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/config/__init__.py", line 1097, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/home/daw/datascience/lib64/python3.10/site-packages/pluggy/manager.py", line 299, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/assertion/rewrite.py", line 161, in exec_module
    source_stat, co = _rewrite_test(fn, self.config)
  File "/home/daw/datascience/lib64/python3.10/site-packages/_pytest/assertion/rewrite.py", line 360, in _rewrite_test
    co = compile(tree, fn_, "exec", dont_inherit=True)
TypeError: required field "lineno" missing from alias
make: *** [Makefile:20: test] Error 1

I suspect the issue is the use of pytest 6.0.1. It sounds like changes to the ast package broke pytest: https://bugs.python.org/issue43798, pytest-dev/pytest#8539. And, requirements-testing.txt currently pins pytest to version 6.0.1.

Updating to pytest 6.2.5 fixes this specific problem (though now it surfaces a new issue). So, a plausible fix is to replace pytest==6.0.1 with pytest (or pytest<7) in requirements-testing.txt. Is that the right fix?

Is there any reason to pin to version 6 of pytest, or can we update it to use the latest version of pytest (pytest 7)?

@davidwagner
Copy link
Member Author

That fixes the problem for me too, thank you!

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

Successfully merging a pull request may close this issue.

1 participant