Skip to content

Commit 1c9d59d

Browse files
fix(tests): pin attrs<22.2.0 for Python 3.6 in integration tests [backport #4816 to 1.6] (#4820)
## Description `attrs==22.2.0` removed support for Python 3.5 and made Python 3.6 support deprecated. This causes deprecation warnings to be logged and causes our integration tests to fail. This change makes sure we install a version of `attrs<22.2.0` only for these failing integration tests. https://www.attrs.org/en/22.2.0/changelog.html#id1 ## Reviewer Checklist - [ ] Title is accurate. - [ ] Description motivates each change. - [ ] No unnecessary changes were introduced in this PR. - [ ] Avoid breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Release note has been added and follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines), or else `changelog/no-changelog` label added. - [ ] All relevant GitHub issues are correctly linked. - [ ] Backports are identified and tagged with Mergifyio. Co-authored-by: Yun Kim <[email protected]> Co-authored-by: Yun Kim <[email protected]> ## Description <!-- Briefly describe the change and why it was required. --> <!-- If this is a breaking change, explain why it is necessary. Breaking changes must append `!` after the type/scope. See https://ddtrace.readthedocs.io/en/stable/contributing.html for more details. --> ## Checklist - [ ] Followed the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) when writing a release note. - [ ] Add additional sections for `feat` and `fix` pull requests. - [ ] [Library documentation](https://github.com/DataDog/dd-trace-py/tree/1.x/docs) and/or [Datadog's documentation site](https://github.com/DataDog/documentation/) is updated. Link to doc PR in description. <!-- Copy and paste the relevant snippet based on the type of pull request --> <!-- START feat --> ## Motivation <!-- Expand on why the change is required, include relevant context for reviewers --> ## Design <!-- Include benefits from the change as well as possible drawbacks and trade-offs --> ## Testing strategy <!-- Describe the automated tests and/or the steps for manual testing. <!-- END feat --> <!-- START fix --> ## Relevant issue(s) <!-- Link the pull request to any issues related to the fix. Use keywords for links to automate closing the issues once the pull request is merged. --> ## Testing strategy <!-- Describe any added regression tests and/or the manual testing performed. --> <!-- END fix --> ## Reviewer Checklist - [ ] Title is accurate. - [ ] Description motivates each change. - [ ] No unnecessary changes were introduced in this PR. - [ ] Avoid breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Release note has been added and follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines), or else `changelog/no-changelog` label added. - [ ] All relevant GitHub issues are correctly linked. - [ ] Backports are identified and tagged with Mergifyio. Co-authored-by: Brett Langdon <[email protected]>
1 parent 359d9f5 commit 1c9d59d

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

riotfile.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
288288
),
289289
Venv(
290290
name="integration",
291-
pys=select_pys(),
292291
command="pytest --no-cov {cmdargs} tests/integration/",
293292
pkgs={"msgpack": [latest]},
294293
venvs=[
@@ -297,19 +296,43 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
297296
env={
298297
"AGENT_VERSION": "v5",
299298
},
299+
venvs=[
300+
Venv(pys=select_pys(max_version="3.5")),
301+
# DEV: attrs marked Python 3.6 as deprecated in 22.2.0,
302+
# this logs a warning and causes these tests to fail
303+
# https://www.attrs.org/en/22.2.0/changelog.html#id1
304+
Venv(pys=["3.6"], pkgs={"attrs": "<22.2.0"}),
305+
Venv(pys=select_pys(min_version="3.7")),
306+
],
300307
),
301308
Venv(
302309
name="integration-latest",
303310
env={
304311
"AGENT_VERSION": "latest",
305312
},
313+
venvs=[
314+
Venv(pys=select_pys(max_version="3.5")),
315+
# DEV: attrs marked Python 3.6 as deprecated in 22.2.0,
316+
# this logs a warning and causes these tests to fail
317+
# https://www.attrs.org/en/22.2.0/changelog.html#id1
318+
Venv(pys=["3.6"], pkgs={"attrs": "<22.2.0"}),
319+
Venv(pys=select_pys(min_version="3.7")),
320+
],
306321
),
307322
Venv(
308323
name="integration-snapshot",
309324
env={
310325
"DD_TRACE_AGENT_URL": "http://localhost:9126",
311326
"AGENT_VERSION": "testagent",
312327
},
328+
venvs=[
329+
Venv(pys=select_pys(max_version="3.5")),
330+
# DEV: attrs marked Python 3.6 as deprecated in 22.2.0,
331+
# this logs a warning and causes these tests to fail
332+
# https://www.attrs.org/en/22.2.0/changelog.html#id1
333+
Venv(pys=["3.6"], pkgs={"attrs": "<22.2.0"}),
334+
Venv(pys=select_pys(min_version="3.7")),
335+
],
313336
),
314337
],
315338
),

tests/integration/test_integration.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ def test_debug_mode():
5555
assert p.stdout.read() == b""
5656
assert b"DEBUG:ddtrace" not in p.stderr.read()
5757

58+
env = os.environ.copy()
59+
env.update({"DD_TRACE_DEBUG": "true", "DD_CALL_BASIC_CONFIG": "true"})
60+
5861
p = subprocess.Popen(
5962
[sys.executable, "-c", "import ddtrace"],
60-
env=dict(DD_TRACE_DEBUG="true", DD_CALL_BASIC_CONFIG="true"),
63+
env=env,
6164
stdout=subprocess.PIPE,
6265
stderr=subprocess.PIPE,
6366
)
@@ -665,16 +668,18 @@ def test_regression_logging_in_context(tmpdir, logs_injection, debug_mode, patch
665668
""".lstrip()
666669
% str(patch_logging)
667670
)
671+
672+
env = os.environ.copy()
673+
env.update(
674+
{
675+
"DD_TRACE_LOGS_INJECTION": str(logs_injection).lower(),
676+
"DD_TRACE_DEBUG": str(debug_mode).lower(),
677+
"DD_CALL_BASIC_CONFIG": "true",
678+
}
679+
)
680+
668681
p = subprocess.Popen(
669-
[sys.executable, "test.py"],
670-
stdout=subprocess.PIPE,
671-
stderr=subprocess.PIPE,
672-
cwd=str(tmpdir),
673-
env=dict(
674-
DD_TRACE_LOGS_INJECTION=str(logs_injection).lower(),
675-
DD_TRACE_DEBUG=str(debug_mode).lower(),
676-
DD_CALL_BASIC_CONFIG="true",
677-
),
682+
[sys.executable, "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=str(tmpdir), env=env
678683
)
679684
try:
680685
p.wait(timeout=2)

0 commit comments

Comments
 (0)