diff --git a/.flake8 b/.flake8 index e2b3004bf..ffea2a590 100644 --- a/.flake8 +++ b/.flake8 @@ -2,8 +2,9 @@ ignore = E501 # line too long, defer to black F401 # unused import, defer to pylint - W503 # allow line breaks after binary ops, not after - E203 # allow whitespace before ':' (https://github.com/psf/black#slices) + W503 # allow line breaks before binary ops + W504 # allow line breaks after binary ops + E203 # allow whitespace before ':' (https://github.com/psf/black#slices) exclude = .bzr .git @@ -16,3 +17,9 @@ exclude = target reference/ __pycache__ + exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/gen/ + exporter/opentelemetry-exporter-jaeger/build/* + docs/examples/opentelemetry-example-app/src/opentelemetry_example_app/grpc/gen/ + docs/examples/opentelemetry-example-app/build/* + opentelemetry-proto/build/* + opentelemetry-proto/src/opentelemetry/proto/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..7df9dff5d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,81 @@ +name: Test + +on: + push: + branches-ignore: + - 'release/*' + pull_request: + +jobs: + build: + env: + # We use these variables to convert between tox and GHA version literals + py35: 3.5 + py36: 3.6 + py37: 3.7 + py38: 3.8 + pypy3: pypy3 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # ensures the entire test matrix is run, even if one permutation fails + matrix: + python-version: [ py35, py36, py37, py38, pypy3 ] + package: ["instrumentation", "core", "exporter"] + os: [ ubuntu-latest ] + include: + - python-version: py38 + package: "tracecontext" + os: ubuntu-latest + - python-version: py38 + package: "mypy" + os: ubuntu-latest + - python-version: py38 + package: "mypyinstalled" + os: ubuntu-latest + # py35-instrumentation segfaults on 18.04 so we instead run on 20.04 + - python-version: py35 + package: instrumentation + os: ubuntu-20.04 + exclude: + - os: ubuntu-latest + python-version: py35 + package: instrumentation + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ env[matrix.python-version] }} + uses: actions/setup-python@v2 + with: + python-version: ${{ env[matrix.python-version] }} + - name: Install tox + run: pip install -U tox-factor + - name: Cache tox environment + # Preserves .tox directory between runs for faster installs + uses: actions/cache@v2 + with: + path: .tox + key: tox-cache-${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }} + - name: run tox + run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} + misc: + strategy: + fail-fast: false + matrix: + tox-environment: [ "docker-tests", "lint", "docs" ] + name: ${{ matrix.tox-environment }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install tox + run: pip install -U tox + - name: Cache tox environment + # Preserves .tox directory between runs for faster installs + uses: actions/cache@v2 + with: + path: .tox + key: tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }} + - name: run tox + run: tox -e ${{ matrix.tox-environment }} diff --git a/.isort.cfg b/.isort.cfg index b06b3b06d..cf5af7f04 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -15,4 +15,4 @@ multi_line_output=3 skip=target skip_glob=**/gen/*,.venv*/*,venv*/*,reference*/* known_first_party=opentelemetry -known_third_party=psutil,pytest +known_third_party=psutil,pytest,redis,redis_opentracing diff --git a/.pylintrc b/.pylintrc index 9c082a23b..923e74eeb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -5,11 +5,11 @@ # run arbitrary code. extension-pkg-whitelist= -# Add files or directories to the denylist. They should be base names, not +# Add list of files or directories to be excluded. They should be base names, not # paths. ignore=CVS,gen -# Add files or directories matching the regex patterns to the denylist. The +# Add files or directories matching the regex patterns to be excluded. The # regex matches against base names, not paths. ignore-patterns= @@ -65,6 +65,7 @@ disable=missing-docstring, too-few-public-methods, # Might be good to re-enable this later. too-many-instance-attributes, too-many-arguments, + duplicate-code, ungrouped-imports, # Leave this up to isort wrong-import-order, # Leave this up to isort bad-continuation, # Leave this up to black @@ -226,7 +227,7 @@ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ # Argument names that match this expression will be ignored. Default to name # with leading underscore. -ignored-argument-names=_.*|^ignored_|^unused_ +ignored-argument-names=_.*|^ignored_|^unused_|^kwargs|^args # Tells whether we should check for unused import in __init__ files. init-import=no @@ -440,7 +441,8 @@ exclude-protected=_asdict, _fields, _replace, _source, - _make + _make, + _Span # List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls @@ -486,4 +488,4 @@ min-public-methods=2 # Exceptions that will emit a warning when being caught. Defaults to # "Exception". -overgeneral-exceptions=Exception +overgeneral-exceptions=Exception \ No newline at end of file diff --git a/eachdist.ini b/eachdist.ini index 45f298ae5..8b512aba0 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -1,16 +1,28 @@ # These will be sorted first in that order. # All packages that are depended upon by others should be listed here. [DEFAULT] -sortfirst= - ignore= _template reference +sortfirst= + opentelemetry-api + opentelemetry-sdk + opentelemetry-instrumentation + opentelemetry-proto + tests/util + instrumentation/opentelemetry-instrumentation-wsgi + instrumentation/opentelemetry-instrumentation-dbapi + instrumentation/opentelemetry-instrumentation-asgi + instrumentation/opentelemetry-instrumentation-botocore + instrumentation/* + exporter/* + ext/* + [lintroots] extraroots=examples/*,scripts/ subglob=*.py,tests/,test/,src/*,examples/* [testroots] extraroots=examples/*,tests/ -subglob=tests/,test/ +subglob=tests/,test/ \ No newline at end of file diff --git a/tox.ini b/tox.ini index e5f64609f..bd083f0fd 100644 --- a/tox.ini +++ b/tox.ini @@ -2,53 +2,450 @@ skipsdist = True skip_missing_interpreters = True envlist = -; Environments are organized by individual package, allowing -; for specifying supported Python versions per package. + ; Environments are organized by individual package, allowing + ; for specifying supported Python versions per package. + ; opentelemetry-api + py3{5,6,7,8}-test-core-api + pypy3-test-core-api - ; py3{5,6,7,8}-test-flask - ; pypy3-test-flask + ; opentelemetry-proto + py3{5,6,7,8}-test-core-proto + pypy3-test-core-proto - ; py3{5,6,7,8}-test-django - ; pypy3-test-django - lint + ; opentelemetry-sdk + py3{5,6,7,8}-test-core-sdk + pypy3-test-core-sdk + + ; opentelemetry-instrumentation + py3{5,6,7,8}-test-core-instrumentation + pypy3-test-core-instrumentation + + ; docs/getting-started + py3{5,6,7,8}-test-core-getting-started + pypy3-test-core-getting-started + + ; opentelemetry-example-app + py3{5,6,7,8}-test-instrumentation-example-app + pypy3-test-instrumentation-example-app + + ; opentelemetry-instrumentation-aiohttp-client + py3{5,6,7,8}-test-instrumentation-aiohttp-client + pypy3-test-instrumentation-aiohttp-client + + ; opentelemetry-instrumentation-aiopg + py3{5,6,7,8}-test-instrumentation-aiopg + ; instrumentation-aiopg intentionally excluded from pypy3 + + ; opentelemetry-instrumentation-botocore + py3{6,7,8}-test-instrumentation-botocore + pypy3-test-instrumentation-botocore + + ; opentelemetry-instrumentation-django + py3{5,6,7,8}-test-instrumentation-django + pypy3-test-instrumentation-django + + ; opentelemetry-instrumentation-dbapi + py3{5,6,7,8}-test-instrumentation-dbapi + pypy3-test-instrumentation-dbapi + + ; opentelemetry-instrumentation-boto + py3{5,6,7,8}-test-instrumentation-boto + pypy3-test-instrumentation-boto + + ; opentelemetry-instrumentation-elasticsearch + py3{5,6,7,8}-test-instrumentation-elasticsearch{2,5,6,7} + pypy3-test-instrumentation-elasticsearch{2,5,6,7} + + ; opentelemetry-instrumentation-falcon + py3{4,5,6,7,8}-test-instrumentation-falcon + pypy3-test-instrumentation-falcon + + ; opentelemetry-instrumentation-fastapi + ; fastapi only supports 3.6 and above. + py3{6,7,8}-test-instrumentation-fastapi + pypy3-test-instrumentation-fastapi + + ; opentelemetry-instrumentation-flask + py3{5,6,7,8}-test-instrumentation-flask + pypy3-test-instrumentation-flask + + ; opentelemetry-instrumentation-requests + py3{5,6,7,8}-test-instrumentation-requests + pypy3-test-instrumentation-requests + + ; opentelemetry-instrumentation-starlette. + ; starlette only supports 3.6 and above. + py3{6,7,8}-test-instrumentation-starlette + pypy3-test-instrumentation-starlette + + ; opentelemetry-instrumentation-jinja2 + py3{5,6,7,8}-test-instrumentation-jinja2 + pypy3-test-instrumentation-jinja2 + + ; opentelemetry-exporter-jaeger + py3{5,6,7,8}-test-exporter-jaeger + pypy3-test-exporter-jaeger + + ; opentelemetry-exporter-datadog + py3{5,6,7,8}-test-exporter-datadog + + ; opentelemetry-instrumentation-mysql + py3{5,6,7,8}-test-instrumentation-mysql + pypy3-test-instrumentation-mysql + + ; opentelemetry-exporter-opencensus + py3{5,6,7,8}-test-exporter-opencensus + ; exporter-opencensus intentionally excluded from pypy3 + + ; opentelemetry-exporter-otlp + py3{5,6,7,8}-test-exporter-otlp + ; exporter-otlp intentionally excluded from pypy3 + + ; opentelemetry-exporter-prometheus + py3{5,6,7,8}-test-exporter-prometheus + pypy3-test-exporter-prometheus + + ; opentelemetry-instrumentation-psycopg2 + py3{5,6,7,8}-test-instrumentation-psycopg2 + ; ext-psycopg2 intentionally excluded from pypy3 + + ; opentelemetry-instrumentation-pymemcache + py3{5,6,7,8}-test-instrumentation-pymemcache + pypy3-test-instrumentation-pymemcache + + ; opentelemetry-instrumentation-pymongo + py3{5,6,7,8}-test-instrumentation-pymongo + pypy3-test-instrumentation-pymongo + + ; opentelemetry-instrumentation-pymysql + py3{5,6,7,8}-test-instrumentation-pymysql + pypy3-test-instrumentation-pymysql + + ; opentelemetry-instrumentation-pyramid + py3{5,6,7,8}-test-instrumentation-pyramid + pypy3-test-instrumentation-pyramid + + ; opentelemetry-instrumentation-asgi + py3{5,6,7,8}-test-instrumentation-asgi + pypy3-test-instrumentation-asgi + + ; opentelemetry-instrumentation-asyncpg + py3{5,6,7,8}-test-instrumentation-asyncpg + ; ext-asyncpg intentionally excluded from pypy3 + + ; opentelemetry-instrumentation-sqlite3 + py3{5,6,7,8}-test-instrumentation-sqlite3 + pypy3-test-instrumentation-sqlite3 + + ; opentelemetry-instrumentation-wsgi + py3{5,6,7,8}-test-instrumentation-wsgi + pypy3-test-instrumentation-wsgi + + ; opentelemetry-exporter-zipkin + py3{5,6,7,8}-test-exporter-zipkin + pypy3-test-exporter-zipkin + + ; opentelemetry-opentracing-shim + py3{5,6,7,8}-test-core-opentracing-shim + pypy3-test-core-opentracing-shim + + ; opentelemetry-instrumentation-grpc + py3{5,6,7,8}-test-instrumentation-grpc + + ; opentelemetry-instrumentation-sqlalchemy + py3{5,6,7,8}-test-instrumentation-sqlalchemy + pypy3-test-instrumentation-sqlalchemy + + ; opentelemetry-instrumentation-redis + py3{5,6,7,8}-test-instrumentation-redis + pypy3-test-instrumentation-redis + + ; opentelemetry-instrumentation-celery + py3{5,6,7,8}-test-instrumentation-celery + pypy3-test-instrumentation-celery + + ; opentelemetry-instrumentation-system-metrics + py3{5,6,7,8}-test-instrumentation-system-metrics + ; instrumentation-system-metrics intentionally excluded from pypy3 + ; known limitation: gc.get_count won't work under pypy + + ; opentelemetry-instrumentation-tornado + ; instrumentation supports >=6 on Py 3.5 and above. + py3{5,6,7,8}-test-instrumentation-tornado + pypy3-test-instrumentation-tornado + + lint + py38-tracecontext + py38-{mypy,mypyinstalled} + docs + docker-tests [testenv] deps = -c dev-requirements.txt test: pytest -; FIXME: add coverage testing -; FIXME: add mypy testing + coverage: pytest + coverage: pytest-cov + mypy,mypyinstalled: mypy + elasticsearch2: elasticsearch-dsl>=2.0,<3.0 + elasticsearch2: elasticsearch>=2.0,<3.0 + elasticsearch5: elasticsearch-dsl>=5.0,<6.0 + elasticsearch5: elasticsearch>=5.0,<6.0 + elasticsearch6: elasticsearch-dsl>=6.0,<7.0 + elasticsearch6: elasticsearch>=6.0,<7.0 + elasticsearch7: elasticsearch-dsl>=7.0,<8.0 + elasticsearch7: elasticsearch>=7.0,<8.0 + + ; FIXME: add coverage testing + ; FIXME: add mypy testing + +setenv = mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/ changedir = - ;flask: instrumentors/flask/tests - ;django: instrumentors/django/tests + test-core-api: opentelemetry-api/tests + test-core-sdk: opentelemetry-sdk/tests + test-core-proto: opentelemetry-proto/tests + test-core-instrumentation: opentelemetry-instrumentation/tests + test-core-getting-started: docs/getting_started/tests + test-core-opentracing-shim: instrumentation/opentelemetry-instrumentation-opentracing-shim/tests + + test-instrumentation-aiohttp-client: instrumentation/opentelemetry-instrumentation-aiohttp-client/tests + test-instrumentation-aiopg: instrumentation/opentelemetry-instrumentation-aiopg/tests + test-instrumentation-asgi: instrumentation/opentelemetry-instrumentation-asgi/tests + test-instrumentation-asyncpg: instrumentation/opentelemetry-instrumentation-asyncpg/tests + test-instrumentation-boto: instrumentation/opentelemetry-instrumentation-boto/tests + test-instrumentation-botocore: instrumentation/opentelemetry-instrumentation-botocore/tests + test-instrumentation-celery: instrumentation/opentelemetry-instrumentation-celery/tests + test-instrumentation-dbapi: instrumentation/opentelemetry-instrumentation-dbapi/tests + test-instrumentation-django: instrumentation/opentelemetry-instrumentation-django/tests + test-instrumentation-example-app: docs/examples/opentelemetry-example-app/tests + test-instrumentation-elasticsearch{2,5,6,7}: instrumentation/opentelemetry-instrumentation-elasticsearch/tests + test-instrumentation-falcon: instrumentation/opentelemetry-instrumentation-falcon/tests + test-instrumentation-fastapi: instrumentation/opentelemetry-instrumentation-fastapi/tests + test-instrumentation-flask: instrumentation/opentelemetry-instrumentation-flask/tests + test-instrumentation-grpc: instrumentation/opentelemetry-instrumentation-grpc/tests + test-instrumentation-jinja2: instrumentation/opentelemetry-instrumentation-jinja2/tests + test-instrumentation-mysql: instrumentation/opentelemetry-instrumentation-mysql/tests + test-instrumentation-psycopg2: instrumentation/opentelemetry-instrumentation-psycopg2/tests + test-instrumentation-pymemcache: instrumentation/opentelemetry-instrumentation-pymemcache/tests + test-instrumentation-pymongo: instrumentation/opentelemetry-instrumentation-pymongo/tests + test-instrumentation-pymysql: instrumentation/opentelemetry-instrumentation-pymysql/tests + test-instrumentation-pyramid: instrumentation/opentelemetry-instrumentation-pyramid/tests + test-instrumentation-redis: instrumentation/opentelemetry-instrumentation-redis/tests + test-instrumentation-requests: instrumentation/opentelemetry-instrumentation-requests/tests + test-instrumentation-sqlalchemy: instrumentation/opentelemetry-instrumentation-sqlalchemy/tests + test-instrumentation-sqlite3: instrumentation/opentelemetry-instrumentation-sqlite3/tests + test-instrumentation-starlette: instrumentation/opentelemetry-instrumentation-starlette/tests + test-instrumentation-system-metrics: instrumentation/opentelemetry-instrumentation-system-metrics/tests + test-instrumentation-tornado: instrumentation/opentelemetry-instrumentation-tornado/tests + test-instrumentation-wsgi: instrumentation/opentelemetry-instrumentation-wsgi/tests + + test-exporter-jaeger: exporter/opentelemetry-exporter-jaeger/tests + test-exporter-datadog: exporter/opentelemetry-exporter-datadog/tests + test-exporter-opencensus: exporter/opentelemetry-exporter-opencensus/tests + test-exporter-otlp: exporter/opentelemetry-exporter-otlp/tests + test-exporter-prometheus: exporter/opentelemetry-exporter-prometheus/tests + test-exporter-zipkin: exporter/opentelemetry-exporter-zipkin/tests commands_pre = ; Install without -e to test the actual installation - python -m pip install -U pip setuptools wheel + py3{5,6,7,8}: python -m pip install -U pip setuptools wheel +; Install common packages for all the tests. These are not needed in all the +; cases but it saves a lot of boilerplate in this file. + test: pip install {toxinidir}/opentelemetry-api {toxinidir}/opentelemetry-sdk {toxinidir}/tests/util - ;flask: pip install {toxinidir}/instrumentors/flask - ;flask: pip install {toxinidir}/instrumentors/flask[test] + test-core-proto: pip install {toxinidir}/opentelemetry-proto + instrumentation: pip install {toxinidir}/opentelemetry-instrumentation - ;django: pip install {toxinidir}/instrumentors/django - ;django: pip install {toxinidir}/instrumentors/django[test] + example-app: pip install {toxinidir}/opentelemetry-instrumentation {toxinidir}/instrumentation/opentelemetry-instrumentation-requests {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi {toxinidir}/instrumentation/opentelemetry-instrumentation-flask {toxinidir}/docs/examples/opentelemetry-example-app + + getting-started: pip install -e {toxinidir}/opentelemetry-instrumentation -e {toxinidir}/instrumentation/opentelemetry-instrumentation-requests -e {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi -e {toxinidir}/instrumentation/opentelemetry-instrumentation-flask + + celery: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-celery[test] + + grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] + + wsgi,falcon,flask,django,pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi + asgi,starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi + + asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg + + boto: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test] + boto: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-boto[test] + + falcon: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test] + + flask: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-flask[test] + + botocore: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test] + + dbapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi[test] + + django: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-django[test] + + fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-fastapi[test] + + mysql: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi {toxinidir}/instrumentation/opentelemetry-instrumentation-mysql[test] + + opencensus: pip install {toxinidir}/exporter/opentelemetry-exporter-opencensus + + otlp: pip install {toxinidir}/opentelemetry-proto + otlp: pip install {toxinidir}/exporter/opentelemetry-exporter-otlp + + prometheus: pip install {toxinidir}/exporter/opentelemetry-exporter-prometheus + + pymemcache: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pymemcache[test] + + pymongo: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pymongo[test] + + psycopg2: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2[test] + + pymysql: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql[test] + + pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid[test] + + sqlite3: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlite3[test] + + redis: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-redis[test] + + requests: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-requests[test] + + starlette: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette[test] + + tornado: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-tornado + + jinja2: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-jinja2[test] + + aiohttp-client: pip install {toxinidir}/opentelemetry-sdk {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-client + + aiopg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg[test] + + jaeger: pip install {toxinidir}/exporter/opentelemetry-exporter-jaeger + + opentracing-shim: pip install {toxinidir}/opentelemetry-sdk + opentracing-shim: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-opentracing-shim + + datadog: pip install {toxinidir}/opentelemetry-sdk {toxinidir}/exporter/opentelemetry-exporter-datadog + + zipkin: pip install {toxinidir}/exporter/opentelemetry-exporter-zipkin + + sqlalchemy: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy + + system-metrics: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-system-metrics[test] + + elasticsearch{2,5,6,7}: pip install {toxinidir}/opentelemetry-instrumentation {toxinidir}/instrumentation/opentelemetry-instrumentation-elasticsearch[test] + +; In order to get a healthy coverage report, +; we have to install packages in editable mode. + coverage: python {toxinidir}/scripts/eachdist.py install --editable + +; 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: pytest {posargs} + coverage: {toxinidir}/scripts/coverage.sh + + 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 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.8 -#recreate = True +recreate = True deps = -c dev-requirements.txt pylint flake8 isort black + psutil readme_renderer + httpretty commands_pre = - python scripts/eachdist.py install --editable + python scripts/eachdist.py install --editable --with-test-deps commands = python scripts/eachdist.py lint --check-only + +[testenv:docs] +deps = + -c {toxinidir}/dev-requirements.txt + -r {toxinidir}/docs-requirements.txt + +commands_pre = + pip install -e {toxinidir}/opentelemetry-api \ + -e {toxinidir}/opentelemetry-sdk + +changedir = docs + +commands = + sphinx-build -E -a -W -b html -T . _build/html + +[testenv:py38-tracecontext] +basepython: python3.8 +deps = + # needed for tracecontext + aiohttp~=3.6 + # needed for example trace integration + flask~=1.1 + requests~=2.7 + +commands_pre = + pip install -e {toxinidir}/opentelemetry-api \ + -e {toxinidir}/opentelemetry-sdk \ + -e {toxinidir}/opentelemetry-instrumentation \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-requests \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-flask + +commands = + {toxinidir}/scripts/tracecontext-integration-test.sh + +[testenv:docker-tests] +deps = + pytest + asyncpg==0.20.1 + docker-compose >= 1.25.2 + mysql-connector-python ~= 8.0 + pymongo ~= 3.1 + pymysql ~= 0.9.3 + psycopg2-binary ~= 2.8.4 + aiopg >= 0.13.0 + sqlalchemy ~= 1.3.16 + redis ~= 3.3.11 + celery ~= 4.0, != 4.4.4 + +changedir = + tests/opentelemetry-docker-tests/tests + +commands_pre = + pip install -e {toxinidir}/opentelemetry-api \ + -e {toxinidir}/opentelemetry-sdk \ + -e {toxinidir}/opentelemetry-instrumentation \ + -e {toxinidir}/tests/util \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-celery \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-mysql \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2 \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pymongo \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-redis \ + -e {toxinidir}/instrumentation/opentelemetry-instrumentation-system-metrics \ + -e {toxinidir}/exporter/opentelemetry-exporter-opencensus + docker-compose up -d + python check_availability.py +commands = + pytest {posargs} + +commands_post = + docker-compose down -v