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(pytest+unittest): add safety check for Windows paths #7627

Merged
merged 18 commits into from
Nov 20, 2023

Conversation

ericlaz
Copy link
Contributor

@ericlaz ericlaz commented Nov 16, 2023

CIVIS-8034

Motivation

This PR aims to fix a GitHub issue regarding ValueErrors on Windows machines when using different path drives.

What does this PR change?

Adds a few type safety checks around os.path.relpath calls to ensure that the plugin will continue to work smoothly when encountering these edge cases.

Checklist

  • Change(s) are motivated and described in the PR description.
  • Testing strategy is described if automated tests are not included in the PR.
  • Risk is outlined (performance impact, potential for breakage, maintainability, etc).
  • Change is maintainable (easy to change, telemetry, documentation).
  • Library release note guidelines are followed. If no release note is required, add label changelog/no-changelog.
  • Documentation is included (in-code, generated user docs, public corp docs).
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Title is accurate.
  • No unnecessary changes are introduced.
  • Description motivates each change.
  • Avoids breaking API changes unless absolutely necessary.
  • Testing strategy adequately addresses listed risk(s).
  • Change is maintainable (easy to change, telemetry, documentation).
  • Release note makes sense to a user of the library.
  • Reviewer has explicitly 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
  • If this PR 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.
  • This PR doesn't touch any of that.

@ericlaz ericlaz added the CI App label Nov 16, 2023
@pr-commenter
Copy link

pr-commenter bot commented Nov 16, 2023

Benchmarks

Benchmark execution time: 2023-11-20 15:32:23

Comparing candidate commit 9991bac in PR branch eric.navarro/fix-path-issue-windows with baseline commit 3aad540 in branch 2.x.

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

@ericlaz ericlaz marked this pull request as ready for review November 17, 2023 14:40
@ericlaz ericlaz requested review from a team as code owners November 17, 2023 14:40
Co-authored-by: Romain Komorn <136473744+romainkomorndatadog@users.noreply.github.com>
@romainkomorndatadog
Copy link
Collaborator

@ZStriker19 , if you're comfortable merging this so we can get in to 2.3.0, and let us have a follow-up PR to clean up into a helper function and add some tests, go ahead. Otherwise we'll just wait update the PR on Monday and backport into 2.3.

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.

This fix looks good from a core prespective.

@brettlangdon brettlangdon enabled auto-merge (squash) November 17, 2023 20:58
@brettlangdon brettlangdon merged commit 1c9765f into 2.x Nov 20, 2023
138 of 140 checks passed
@brettlangdon brettlangdon deleted the eric.navarro/fix-path-issue-windows branch November 20, 2023 16:08
github-actions bot pushed a commit that referenced this pull request Nov 20, 2023
[CIVIS-8034

](https://datadoghq.atlassian.net/browse/CIVIS-8034?atlOrigin=eyJpIjoiNTVhNTFmZjkxYWRkNGUwOThiYzExYjhkZTkxZjU5NzQiLCJwIjoiaiJ9)

## Motivation

This PR aims to fix a GitHub issue regarding ValueErrors on Windows
machines when using different path drives.

## What does this PR change?

Adds a few type safety checks around `os.path.relpath` calls to ensure
that the plugin will continue to work smoothly when encountering these
edge cases.

## 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] Risk is outlined (performance impact, potential for breakage,
maintainability, etc).
- [X] Change is maintainable (easy to change, telemetry, documentation).
- [X] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed. If no release note is required, add label
`changelog/no-changelog`.
- [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))

## Reviewer Checklist

- [x] Title is accurate.
- [x] No unnecessary changes are introduced.
- [x] Description motivates each change.
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes unless absolutely necessary.
- [x] Testing strategy adequately addresses listed risk(s).
- [x] Change is maintainable (easy to change, telemetry, documentation).
- [x] Release note makes sense to a user of the library.
- [x] Reviewer has explicitly 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)
- [x] If this PR 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`.
- [x] This PR doesn't touch any of that.

---------

Co-authored-by: Romain Komorn <136473744+romainkomorndatadog@users.noreply.github.com>
Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
(cherry picked from commit 1c9765f)
emmettbutler pushed a commit that referenced this pull request Nov 29, 2023
[CIVIS-8034

](https://datadoghq.atlassian.net/browse/CIVIS-8034?atlOrigin=eyJpIjoiNTVhNTFmZjkxYWRkNGUwOThiYzExYjhkZTkxZjU5NzQiLCJwIjoiaiJ9)

## Motivation

This PR aims to fix a GitHub issue regarding ValueErrors on Windows
machines when using different path drives.

## What does this PR change?

Adds a few type safety checks around `os.path.relpath` calls to ensure
that the plugin will continue to work smoothly when encountering these
edge cases.

## 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] Risk is outlined (performance impact, potential for breakage,
maintainability, etc).
- [X] Change is maintainable (easy to change, telemetry, documentation).
- [X] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed. If no release note is required, add label
`changelog/no-changelog`.
- [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))

## Reviewer Checklist

- [x] Title is accurate.
- [x] No unnecessary changes are introduced.
- [x] Description motivates each change.
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes unless absolutely necessary.
- [x] Testing strategy adequately addresses listed risk(s).
- [x] Change is maintainable (easy to change, telemetry, documentation).
- [x] Release note makes sense to a user of the library.
- [x] Reviewer has explicitly 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)
- [x] If this PR 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`.
- [x] This PR doesn't touch any of that.

---------

Co-authored-by: Romain Komorn <136473744+romainkomorndatadog@users.noreply.github.com>
Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants