Closed romainkomorndatadog closed 1 week ago
Branch report: romain.komorn/SDTEST-326/make_pytest_source_properly_relative_to_repo
Commit report: 8b803fb
Test service: dd-trace-py
:white_check_mark: 0 Failed, 176719 Passed, 1217 Skipped, 11h 27m 23.87s Total duration (26m 21.08s time saved)
Benchmark execution time: 2024-06-26 11:49:08
Comparing candidate commit 0bb75e46ed2f172213b748247c8c66f27dcf6fdc in PR branch romain.komorn/SDTEST-326/make_pytest_source_properly_relative_to_repo
with baseline commit 3010fa1b350f12fb0f38272c8e54acd343459053 in branch main
.
Found 1 performance improvements and 0 performance regressions! Performance is the same for 220 metrics, 9 unstable metrics.
max_rss_usage
[-6.725MB; -6.554MB] or [-14.481%; -14.112%]Switched to using our more robust and already existing internal undecorated()
function, and use item.path
(if available) or item.fspath
(for pytest<=7.0
).
Manually tested this with:
pytest~=3.0
and Python 3.7
pytest~=7.0
and Python 3.10
pytest~=8.0
and Python 3.11
and results all look good:
nested_dir/
in my test repo, but the source file info remains properly relative to the repo root (by showing the path as nested_dir/test_mydecorators.py
.The backport to 2.7
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.7 2.7
# Navigate to the new working tree
cd .worktrees/backport-2.7
# Create a new branch
git switch --create backport-9586-to-2.7
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 203e89489f1e698a127317dc57b01e9d6467e859
# Push it to GitHub
git push --set-upstream origin backport-9586-to-2.7
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.7
Then, create a pull request where the base
branch is 2.7
and the compare
/head
branch is backport-9586-to-2.7
.
The backport to 2.8
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.8 2.8
# Navigate to the new working tree
cd .worktrees/backport-2.8
# Create a new branch
git switch --create backport-9586-to-2.8
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 203e89489f1e698a127317dc57b01e9d6467e859
# Push it to GitHub
git push --set-upstream origin backport-9586-to-2.8
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.8
Then, create a pull request where the base
branch is 2.8
and the compare
/head
branch is backport-9586-to-2.8
.
The backport to 2.9
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.9 2.9
# Navigate to the new working tree
cd .worktrees/backport-2.9
# Create a new branch
git switch --create backport-9586-to-2.9
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 203e89489f1e698a127317dc57b01e9d6467e859
# Push it to GitHub
git push --set-upstream origin backport-9586-to-2.9
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.9
Then, create a pull request where the base
branch is 2.9
and the compare
/head
branch is backport-9586-to-2.9
.
Fixes an issue where decorated test functions could resolve to the wrong location when certain decorators (eg: @mock.patch) were used.
This also fixes the fact that source file info paths might not always be relative to the current repo root.
The test added in this PR verifies the above by using a variety of decorators as well as executing from the
nested_dir
directory instead of the git repo root, with the source file info properly showing the path asnested_dir/test_mydecorators.py
.Checklist
changelog/no-changelog
is set@DataDog/apm-tees
.Reviewer Checklist