diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 81f7bb40799..d7c7e0b8011 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -176,6 +176,25 @@ jobs: - name: Run tests run: tox -e lint-opentelemetry-opentracing-shim + lint-opentelemetry-opentracing-example: + name: opentelemetry-opentracing-example + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e lint-opentelemetry-opentracing-example + lint-opentelemetry-opencensus-shim: name: opentelemetry-opencensus-shim runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index afe82e55b2b..adcaa506b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#5076](https://github.com/open-telemetry/opentelemetry-python/pull/5076)) - `opentelemetry-semantic-conventions`: use `X | Y` union annotation ([#5096](https://github.com/open-telemetry/opentelemetry-python/pull/5096)) +- Fix separate pylint config for opentracing example to resolve `# pylint: disable=import-error` workaround + ([#5037](https://github.com/open-telemetry/opentelemetry-python/pull/5037)) + - `opentelemetry-sdk`: Fix `ProcessResourceDetector` to use `sys.orig_argv` so that `process.command`, `process.command_line`, and `process.command_args` reflect the original invocation for `python -m ` runs (where `sys.argv[0]` is rewritten to the module path) ([#5083](https://github.com/open-telemetry/opentelemetry-python/pull/5083)) - `opentelemetry-sdk`: make resource detector ordering deterministic diff --git a/docs/examples/opentracing/.pylintrc b/docs/examples/opentracing/.pylintrc new file mode 100644 index 00000000000..91f98df0b46 --- /dev/null +++ b/docs/examples/opentracing/.pylintrc @@ -0,0 +1,9 @@ +[MASTER] +init-hook='import sys; sys.path.insert(0, ".")' + +[MESSAGES CONTROL] +disable=missing-docstring, + too-few-public-methods + +[FORMAT] +expected-line-ending-format= \ No newline at end of file diff --git a/docs/examples/opentracing/rediscache.py b/docs/examples/opentracing/rediscache.py index 61025eac725..e6d9a1eca85 100644 --- a/docs/examples/opentracing/rediscache.py +++ b/docs/examples/opentracing/rediscache.py @@ -7,11 +7,8 @@ import pickle from functools import wraps -# FIXME The pylint disablings are needed here because the code of this -# example is being executed against the tox.ini of the main -# opentelemetry-python project. Find a way to separate the two. -import redis # pylint: disable=import-error -import redis_opentracing # pylint: disable=import-error +import redis +import redis_opentracing class RedisCache: diff --git a/tox.ini b/tox.ini index 4320dce7339..97aae98d9f8 100644 --- a/tox.ini +++ b/tox.ini @@ -39,6 +39,7 @@ envlist = py3{10,11,12,13,14,14t}-test-opentelemetry-opentracing-shim pypy3-test-opentelemetry-opentracing-shim lint-opentelemetry-opentracing-shim + lint-opentelemetry-opentracing-example py3{10,11,12,13,14}-test-opentelemetry-opencensus-shim ; opencensus-shim intentionally excluded from pypy3 (grpcio install fails) @@ -402,3 +403,13 @@ deps = pre-commit commands = pre-commit run --color=always --all-files {posargs} + +[testenv:lint-opentelemetry-opentracing-example] +deps = + -r dev-requirements.txt + -r {toxinidir}/docs/examples/opentracing/requirements.txt +setenv = + PYTHONPATH = {toxinidir}/docs/examples/opentracing +commands = + pylint --rcfile {toxinidir}/docs/examples/opentracing/.pylintrc {toxinidir}/docs/examples/opentracing + \ No newline at end of file