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

remove duplicate code in decorators #3647

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mabdinur
Copy link
Contributor

@mabdinur mabdinur commented Dec 9, 2024

Motivation

  • Clean up

Changes

  • Removes duplicate code from missing_feature, incomplete_test_app, irrelevant, and flaky decorators
  • Removes _get_skipped_item . _get_expected_failure_item can be used in all decorators.
  • Simplifies the first if statement in _should_skip

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes (if something not related to your task is failing, you can ignore it)
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner. We're working on refining the codeowners file quickly.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • If PR title starts with [<language>], double-check that only <language> is impacted by the change
  • No system-tests internal is modified. Otherwise, I have the approval from R&P team
  • CI is green, or failing jobs are not related to this change (and you are 100% sure about this statement)
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added (or removed)?

@mabdinur
Copy link
Contributor Author

mabdinur commented Dec 9, 2024

@mabdinur mabdinur force-pushed the munir/refactor-decorators branch 2 times, most recently from 53e7da1 to 48b70ec Compare December 9, 2024 19:25
@mabdinur mabdinur force-pushed the munir/refactor-decorators branch from 48b70ec to 26aa2b2 Compare December 9, 2024 19:26
@mabdinur mabdinur force-pushed the munir/refactor-decorators branch from 5bec54b to 7f88031 Compare December 9, 2024 19:37
@mabdinur mabdinur marked this pull request as ready for review December 9, 2024 19:38
@mabdinur mabdinur requested review from a team as code owners December 9, 2024 19:38
@mabdinur mabdinur requested review from mhlidd and removed request for a team December 9, 2024 19:38
@cbeauchesne
Copy link
Collaborator

rebasing to fix issue on python

Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

CI is failing

@mabdinur
Copy link
Contributor Author

mabdinur commented Dec 10, 2024

CI is failing

The java parametric test failure was due to a flaky test. After one rerun that scenario is now green.

The php failures seem unrelated to this PR. The same tests are also failing on the main branch: https://github.com/DataDog/system-tests/actions/runs/12257217102/job/34195001337. We are mainly seeing failures on php-dev so it likely caused by a recent regression. Maybe this change: DataDog/dd-trace-php#2735?

cc: @cataphract

@cbeauchesne
Copy link
Collaborator

cbeauchesne commented Dec 11, 2024

yep, for PHP : #3658

reviewing the PR

tests/parametric/test_span_events.py Outdated Show resolved Hide resolved
utils/_decorators.py Outdated Show resolved Hide resolved
utils/_decorators.py Outdated Show resolved Hide resolved
utils/_decorators.py Outdated Show resolved Hide resolved
def missing_feature(condition=None, library=None, weblog_variant=None, reason=None, force_skip: bool = False):
"""decorator, allow to mark a test function/class as missing"""
expected_to_fail = _expected_to_fail(library=library, weblog_variant=weblog_variant, condition=condition)
return partial(decorator, expected_to_fail, force_skip, condition, "missing_feature", reason)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using named argument will be easier to maintain

Suggested change
return partial(decorator, expected_to_fail, force_skip, condition, "missing_feature", reason)
return partial(decorator, expected_to_fail=expected_to_fail, force_skip=force_skip, condition=condition, decorator_type="missing_feature", reason=reason)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can only use positional arguments in partial(..).

Comment on lines 119 to 120
force_skip = False
return partial(decorator, expected_to_fail, force_skip, condition, "incomplete_test_app", reason)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment as above :

Suggested change
force_skip = False
return partial(decorator, expected_to_fail, force_skip, condition, "incomplete_test_app", reason)
return partial(decorator, expected_to_fail=expected_to_fail, force_skip=False, condition=condition, decorator_type="incomplete_test_app", reason=reason)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can only use positional arguments in partial(....)

utils/_decorators.py Outdated Show resolved Hide resolved
@mabdinur mabdinur requested a review from cbeauchesne December 11, 2024 17:09
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.

2 participants