From 68e8f4f7997c096b5518c94bd0c0a2ee117efae3 Mon Sep 17 00:00:00 2001 From: Chris Kleinknecht Date: Tue, 3 Dec 2019 18:45:33 -0500 Subject: [PATCH] Add typegaurd, use with pytest --- opentelemetry-api/tests/conftest.py | 19 +++++++++++++++++++ opentelemetry-sdk/tests/conftest.py | 19 +++++++++++++++++++ tox.ini | 1 + 3 files changed, 39 insertions(+) create mode 100644 opentelemetry-api/tests/conftest.py create mode 100644 opentelemetry-sdk/tests/conftest.py diff --git a/opentelemetry-api/tests/conftest.py b/opentelemetry-api/tests/conftest.py new file mode 100644 index 00000000000..8603746ab57 --- /dev/null +++ b/opentelemetry-api/tests/conftest.py @@ -0,0 +1,19 @@ +# Copyright 2019, OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +def pytest_sessionstart(session): + from typeguard.importhook import install_import_hook + + install_import_hook("opentelemetry") diff --git a/opentelemetry-sdk/tests/conftest.py b/opentelemetry-sdk/tests/conftest.py new file mode 100644 index 00000000000..8603746ab57 --- /dev/null +++ b/opentelemetry-sdk/tests/conftest.py @@ -0,0 +1,19 @@ +# Copyright 2019, OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +def pytest_sessionstart(session): + from typeguard.importhook import install_import_hook + + install_import_hook("opentelemetry") diff --git a/tox.ini b/tox.ini index 9898094ca3d..ca80825f30d 100644 --- a/tox.ini +++ b/tox.ini @@ -25,6 +25,7 @@ deps = ; skip 5.2.3 pytest due to bug ; https://github.com/pytest-dev/pytest/issues/6194 test: pytest!=5.2.3 + test: typeguard coverage: pytest!=5.2.3 coverage: pytest-cov mypy,mypyinstalled: mypy==0.740