Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Switch inferred spans tests to pytest parametrized. #455

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

Merged
merged 5 commits into from
Mar 27, 2024

Conversation

purple4reina
Copy link
Contributor

@purple4reina purple4reina commented Mar 27, 2024

What does this PR do?

Uses pytest.mark.parametrize to create a single parameterized test for creating inferred spans.

Motivation

Cleaner. Easier to read. <3 pytest

Testing Guidelines

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

https://datadoghq.atlassian.net/browse/SVLS-4291

@purple4reina purple4reina requested a review from a team as a code owner March 27, 2024 19:01
@purple4reina purple4reina force-pushed the rey.abolofia/infspan-pytest branch from 0629cc0 to 0e76664 Compare March 27, 2024 19:10
return result_func


create_inferred_span = wrapped_span_creator(create_inferred_span)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests still pass if I remove this stuff

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm yeah then definitely remove

assert actual.parent_id == parent.span_id
assert finish_time == expect.start
else:
assert mock_span_finish.call_count == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

the else is just to crash right? since the counts will always be 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope! Maybe I should change this, but I overloaded parent_name. If set, then we essentially assume there's two inferred spans. If not set, then there's only one inferred span.

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'll add a comment for clarification

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect

@purple4reina purple4reina merged commit 22629ea into main Mar 27, 2024
@purple4reina purple4reina deleted the rey.abolofia/infspan-pytest branch March 27, 2024 19:38
Copy link
Contributor

@joeyzhao2018 joeyzhao2018 left a comment

Choose a reason for hiding this comment

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

👍

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.

4 participants