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

nosetests errors when encountering special module-level function with annotations #1095

Open
znewman01 opened this issue Aug 29, 2019 · 0 comments

Comments

@znewman01
Copy link

Example:

def setup_module() -> None:
    pass

It happens for setup_module() and teardown_module() but not e.g. test_something().

To repro:

$ python --version; nosetests -V
Python 3.7.3
nosetests version 1.3.7
$ echo "def setup_module() -> None: pass" > nose_test.py
$ nosetests nose_test.py

which gives the following stacktrace (path information stripped):

ERROR: test suite for <module 'test.nose_test' from '/tmp/nose_test.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../python3.7/site-packages/nose/suite.py", line 209, in run
    self.setUp()
  File ".../python3.7/site-packages/nose/suite.py", line 292, in setUp
    self.setupContext(ancestor)
  File ".../python3.7/site-packages/nose/suite.py", line 315, in setupContext
    try_run(context, names)
  File "../lib/python3.7/site-packages/nose/util.py", line 453, in try_run
    inspect.getargspec(func)
  File ".../lib/python3.7/inspect.py", line 1082, in getargspec
    raise ValueError("Function has keyword-only parameters or annotations"
ValueError: Function has keyword-only parameters or annotations, use getfullargspec() API which can support them

----------------------------------------------------------------------
Ran 0 tests in 0.001s

FAILED (errors=1)

Comes from nose.util:try_run. I'm not sure what I'd suggest doing about it while supporting Python 2.

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

No branches or pull requests

1 participant