Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci_visibility): support pytest 8.0.0 #8357

Conversation

romainkomorndatadog
Copy link
Collaborator

@romainkomorndatadog romainkomorndatadog commented Feb 9, 2024

Addresses #8220 and fixes an issue with pytest 8.x and above
(brought by pytest-dev/pytest#11137 ) where pytest.Package objects no longer have an attached module attribute.

This also changes the testing matrix to include version ~=8.0, but maintains ~=7.0 as a separate testing environment.

Checklist

  • Change(s) are motivated and described in the PR description
  • Testing strategy is described if automated tests are not included in the PR
  • Risks are described (performance impact, potential for breakage, maintainability)
  • Change is maintainable (easy to change, telemetry, documentation)
  • Library release note guidelines are followed or label changelog/no-changelog is set
  • Documentation is included (in-code, generated user docs, public corp docs)
  • Backport labels are set (if applicable)
  • If this PR changes the public interface, I've notified @DataDog/apm-tees.
  • If change touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.

Reviewer Checklist

  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Description motivates each change
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Change is maintainable (easy to change, telemetry, documentation)
  • Release note makes sense to a user of the library
  • Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@romainkomorndatadog romainkomorndatadog marked this pull request as draft February 9, 2024 19:15
@romainkomorndatadog romainkomorndatadog self-assigned this Feb 9, 2024
@romainkomorndatadog romainkomorndatadog changed the title Romain.komorn/civis 8969/fix civis crash when module has no path WIP fix(ci_visibility): support pytest 8.0.0 Feb 9, 2024
@pr-commenter
Copy link

pr-commenter bot commented Feb 9, 2024

Benchmarks

Benchmark execution time: 2024-02-15 13:14:51

Comparing candidate commit c53be90 in PR branch romain.komorn/CIVIS-8969/fix_civis_crash_when_module_has_no_path with baseline commit 0fe647e in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 173 metrics, 9 unstable metrics.

…s_no_path' of github.com:DataDog/dd-trace-py into romain.komorn/CIVIS-8969/fix_civis_crash_when_module_has_no_path
…s_no_path' of github.com:DataDog/dd-trace-py into romain.komorn/CIVIS-8969/fix_civis_crash_when_module_has_no_path
@romainkomorndatadog
Copy link
Collaborator Author

The weeds are getting a bit deeper. I need to rewrite everything that touches item.parent because we now have items where the parent is no longer what it used to be (namely, there are pytest.Dir type objects where there used to be pytest.Package objects).

We have long-delayed plans to introduce an API to centralize all the span/event creation into the CIVisibility service, and greatly simplify the integration-side code, and I've made the decision to do that work now, instead of making a slew of changes in our plugin that I'll unwind later this quarter.

That does mean slowing down the response to #8220 , but it should be better for the long term.

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Feb 15, 2024

Datadog Report

Branch report: romain.komorn/CIVIS-8969/fix_civis_crash_when_module_has_no_path
Commit report: 95c4f28
Test service: dd-trace-py

✅ 0 Failed, 171710 Passed, 1052 Skipped, 11h 50m 34.65s Total duration (26m 55.62s time saved)

@romainkomorndatadog romainkomorndatadog changed the title WIP fix(ci_visibility): support pytest 8.0.0 fix(ci_visibility): support pytest 8.0.0 Feb 15, 2024
@romainkomorndatadog romainkomorndatadog marked this pull request as ready for review February 15, 2024 14:29
@romainkomorndatadog
Copy link
Collaborator Author

Okay, so, I kind of "lied" in my last comment. I wanted to do "the right thing" but that would've involved pinning pytest in our repo's 1200 riot environments which would've been a pretty big pain, so I decided to bite the bullet on coming up with a short-term patch to support 8.0.

The result is this PR which I think should bridge the gap between now and when I've undertaken the rewrite I mentioned in my previous comment.

Copy link
Contributor

@mabdinur mabdinur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update the release note. Aside from that LGTM

@romainkomorndatadog romainkomorndatadog merged commit 78d5b98 into main Feb 21, 2024
149 checks passed
@romainkomorndatadog romainkomorndatadog deleted the romain.komorn/CIVIS-8969/fix_civis_crash_when_module_has_no_path branch February 21, 2024 16:54
Copy link
Contributor

The backport to 2.4 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.4 2.4
# Navigate to the new working tree
cd .worktrees/backport-2.4
# Create a new branch
git switch --create backport-8357-to-2.4
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 78d5b98c58691c750cecc6954dc4bd6b452f0226
# Push it to GitHub
git push --set-upstream origin backport-8357-to-2.4
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.4

Then, create a pull request where the base branch is 2.4 and the compare/head branch is backport-8357-to-2.4.

Copy link
Contributor

The backport to 2.5 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.5 2.5
# Navigate to the new working tree
cd .worktrees/backport-2.5
# Create a new branch
git switch --create backport-8357-to-2.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 78d5b98c58691c750cecc6954dc4bd6b452f0226
# Push it to GitHub
git push --set-upstream origin backport-8357-to-2.5
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.5

Then, create a pull request where the base branch is 2.5 and the compare/head branch is backport-8357-to-2.5.

github-actions bot pushed a commit that referenced this pull request Feb 21, 2024
Addresses #8220 and fixes
an issue with `pytest` `8.x` and above
(brought by pytest-dev/pytest#11137 ) where
`pytest.Package` objects no longer have an attached `module` attribute.

This also changes the testing matrix to include version `~=8.0`, but
maintains `~=7.0` as a separate testing environment.

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

---------

Co-authored-by: Munir Abdinur <munir.abdinur@datadoghq.com>
(cherry picked from commit 78d5b98)
mabdinur pushed a commit that referenced this pull request Feb 21, 2024
Backport 78d5b98 from #8357 to 2.6.

Addresses #8220 and fixes
an issue with `pytest` `8.x` and above
(brought by pytest-dev/pytest#11137 ) where
`pytest.Package` objects no longer have an attached `module` attribute.

This also changes the testing matrix to include version `~=8.0`, but
maintains `~=7.0` as a separate testing environment.

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: Romain Komorn <136473744+romainkomorndatadog@users.noreply.github.com>
romainkomorndatadog added a commit that referenced this pull request Feb 22, 2024
Backport 78d5b98 from #8357 to 2.5.

Addresses #8220 and fixes
an issue with `pytest` `8.x` and above
(brought by pytest-dev/pytest#11137 ) where
`pytest.Package` objects no longer have an attached `module` attribute.

This also changes the testing matrix to include version `~=8.0`, but
maintains `~=7.0` as a separate testing environment.

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: Federico Mon <federico.mon@datadoghq.com>
romainkomorndatadog added a commit that referenced this pull request Feb 22, 2024
Backport 78d5b98 from #8357 to 2.4.

Addresses #8220 and fixes
an issue with `pytest` `8.x` and above
(brought by pytest-dev/pytest#11137 ) where
`pytest.Package` objects no longer have an attached `module` attribute.

This also changes the testing matrix to include version `~=8.0`, but
maintains `~=7.0` as a separate testing environment.

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: Federico Mon <federico.mon@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants