Skip to content

Commit ffa291c

Browse files
authored
Fix: Unable to run ADOT Python unit tests with latest Tox release (aws-observability#521)
Tox 3.27.1 was released on November 14, 2022 — before Python 3.12 (October 2023) and Python 3.13 (October 2024) — and does not officially support either version. This PR resolves the blocking issue caused by using the latest Tox release 4.30.3. Changes: - Updated tox.ini to pass valid VCS requirement strings to pip and avoid shell/INI parsing issues. - Removed stray spaces before '@' in pip VCS requirement specifiers. - Removed unnecessary wrapping quotes so strings are not passed with quote characters. - Escaped the '#' in INI fragments to ensure the tox/INI parser preserves pip fragments (e.g., `#egg=...`). Tested with: ```bash python -m venv .venv source .venv/bin/activate pip install tox tox -e lint tox -e spellcheck tox -e 3.9-test-aws-opentelemetry-distro tox -e 3.10-test-aws-opentelemetry-distro tox -e 3.11-test-aws-opentelemetry-distro tox -e 3.12-test-aws-opentelemetry-distro tox -e 3.13-test-aws-opentelemetry-distro ``` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
2 parents 533fafd + 83a9599 commit ffa291c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/actions/set_up/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ runs:
2727

2828
- name: Install tox
2929
shell: bash
30-
run: pip install tox==3.27.1 tox-factor
30+
run: |
31+
pip install tox==4.30.3
3132
3233
- name: Cache tox environment
3334
# Preserves .tox directory between runs for faster installs
@@ -41,4 +42,7 @@ runs:
4142
- name: Run unit tests/benchmarks with tox
4243
if: ${{ inputs.run_unit_tests == 'true' }}
4344
shell: bash
44-
run: tox -f ${{ inputs.python_version }}-${{ inputs.package_name }} -- -ra
45+
run: |
46+
ENV_NAME="${{ inputs.python_version }}-test-${{ inputs.package_name }}"
47+
echo "Running tox env: $ENV_NAME"
48+
tox -e "$ENV_NAME" -- -ra

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ If your change does not need a CHANGELOG entry, add the "skip changelog" label t
1717
([#497](https://github.com/aws-observability/aws-otel-python-instrumentation/pull/497))
1818
- Fix timeout handling for exceeded deadline in retry logic in OTLPAwsLogsExporter
1919
([#501](https://github.com/aws-observability/aws-otel-python-instrumentation/pull/501))
20+
- Fix: Unable to run ADOT Python unit tests with latest Tox release
21+
([#521](https://github.com/aws-observability/aws-otel-python-instrumentation/pull/521))

tox.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ commands_pre =
3535
; cases but it saves a lot of boilerplate in this file.
3636
test: pip install botocore
3737
test: pip install gevent
38-
test: pip install "opentelemetry-api[test] @ {env:CORE_REPO}#egg=opentelemetry-api&subdirectory=opentelemetry-api"
39-
test: pip install "opentelemetry-sdk[test] @ {env:CORE_REPO}#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk"
40-
test: pip install "opentelemetry-instrumentation[test] @ {env:CONTRIB_REPO}#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation"
41-
test: pip install "opentelemetry-exporter-otlp[test] @ {env:CORE_REPO}#egg=opentelemetry-exporter-otlp&subdirectory=exporter/opentelemetry-exporter-otlp"
42-
test: pip install "opentelemetry-test-utils @ {env:CORE_REPO}#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils"
38+
test: pip install opentelemetry-api[test]@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api
39+
test: pip install opentelemetry-sdk[test]@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk
40+
test: pip install opentelemetry-instrumentation[test]@{env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation
41+
test: pip install opentelemetry-exporter-otlp[test]@{env:CORE_REPO}\#egg=opentelemetry-exporter-otlp&subdirectory=exporter/opentelemetry-exporter-otlp
42+
test: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils
4343
aws-opentelemetry-distro: pip install {toxinidir}/aws-opentelemetry-distro
4444

4545
commands =

0 commit comments

Comments
 (0)