Simplify pytest configuration
It seems to be doing fine on its own. As a bonus this restores running doctests from the injector source code which I broke when I made it a package (code in injector/__init__.py) instead of a simple module. *But* we need to start skipping running doctests for get_bindings on Python versions that don't support Annotated (or don't support it well enough).
This commit is contained in:
parent
b399dcf908
commit
ae39af0ad8
|
@ -1,7 +0,0 @@
|
|||
import os.path
|
||||
|
||||
test_sources = ['injector', 'injector_test.py', 'README.md']
|
||||
|
||||
|
||||
def pytest_ignore_collect(path, config):
|
||||
return not os.path.basename(str(path)) in test_sources
|
|
@ -1003,6 +1003,10 @@ def get_bindings(callable: Callable) -> Dict[str, type]:
|
|||
>>> get_bindings(function3)
|
||||
{'a': <class 'int'>}
|
||||
|
||||
>>> import sys, pytest
|
||||
>>> if sys.version_info < (3, 7, 0):
|
||||
... pytest.skip('Python 3.7.0 required for sufficient Annotated support')
|
||||
|
||||
>>> # The simple case of no @inject but injection requested with Inject[...]
|
||||
>>> def function4(a: Inject[int], b: str) -> None:
|
||||
... pass
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
[pytest]
|
||||
python_files = injector_test.py injector_test_py3.py
|
||||
addopts = -v --tb=native --doctest-glob=*.md --doctest-modules --cov-report term --cov-report html --cov-report xml --cov=injector --cov-branch
|
||||
norecursedirs = __pycache__ *venv* .git build
|
||||
|
|
Loading…
Reference in New Issue