Ensure that type info is picked up from installed package.
* Ensure that type info is picked up from installed package.
This required moving all top-level modules to a sub-package, to not
create collisions with py.typed marker files.
See
* Add MANIFEST.in for SDK package.
@@ -5,7 +5,7 @@ envlist =
py3{4,5,6,7,8}-test-{api,sdk,example-app,ext-wsgi,ext-http-requests}
pypy3-test-{api,sdk,example-app,ext-wsgi,ext-http-requests}
lint
- py37-mypy
+ py37-{mypy,mypyinstalled}
docs
[travis]
@@ -14,7 +14,7 @@ python =
[testenv]
deps =
- mypy: mypy~=0.711
+ mypy,mypyinstalled: mypy~=0.711
setenv =
mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/
@@ -39,11 +39,21 @@ commands_pre =
wsgi: pip install {toxinidir}/ext/opentelemetry-ext-wsgi
http-requests: pip install {toxinidir}/ext/opentelemetry-ext-http-requests
+; Using file:// here because otherwise tox invokes just "pip install
+; opentelemetry-api", leading to an error
+ mypyinstalled: pip install file://{toxinidir}/opentelemetry-api/
+
commands =
+ test: python -m unittest discover
+
mypy: mypy --namespace-packages opentelemetry-api/src/opentelemetry/
; For test code, we don't want to enforce the full mypy strictness
mypy: mypy --namespace-packages --config-file=mypy-relaxed.ini opentelemetry-api/tests/
- test: python -m unittest discover
+
+; Test that mypy can pick up typeinfo from an installed package (otherwise,
+; implicit Any due to unfollowed import would result).
+ mypyinstalled: mypy --namespace-packages opentelemetry-api/tests/mypysmoke.py --strict
+
[testenv:lint]
basepython: python3.7
