-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
This is pretty much the same issue as #3635.
To reproduce, run the following:
import typing
import _pytest.fixtures
print(typing.get_type_hints(_pytest.fixtures.FuncFixtureInfo.__init__))Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python37\lib\typing.py", line 1001, in get_type_hints
value = _eval_type(value, globalns, localns)
File "C:\Python37\lib\typing.py", line 260, in _eval_type
return t._evaluate(globalns, localns)
File "C:\Python37\lib\typing.py", line 464, in _evaluate
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
NameError: name 'List' is not defined
This happens because of these type annotations:
pytest/src/_pytest/fixtures.py
Lines 303 to 311 in 7d4c4c6
| class FuncFixtureInfo(object): | |
| # original function argument names | |
| argnames = attr.ib(type=tuple) | |
| # argnames that function immediately requires. These include argnames + | |
| # fixture names specified via usefixtures and via autouse=True in fixture | |
| # definitions. | |
| initialnames = attr.ib(type=tuple) | |
| names_closure = attr.ib(type="List[str]") | |
| name2fixturedefs = attr.ib(type="List[str, List[FixtureDef]]") |
Version info:
- Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
- Both
pytest 3.7.1andpytest 3.7.2.dev41+g7d4c4c66
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels