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

feat: Allow for disabling backend when running tests via pytest #2340

Merged
merged 5 commits into from
Oct 9, 2023

Conversation

kratsg
Copy link
Contributor

@kratsg kratsg commented Sep 20, 2023

Pull Request Description

Resolves #1454. This adds --disable-backend that can be specified to skip those backends as part of the testing suite.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Add pytest configuration `--disable-backend` that will skip tests that use
  that backend choice.

@kratsg kratsg added feat/enhancement New feature or request tests pytest user request Request coming form a pyhf user labels Sep 20, 2023
@kratsg kratsg self-assigned this Sep 20, 2023
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (d4f6b30) 98.28% compared to head (65a2392) 98.28%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2340   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files          69       69           
  Lines        4538     4538           
  Branches      803      803           
=======================================
  Hits         4460     4460           
  Misses         45       45           
  Partials       33       33           
Flag Coverage Δ
contrib 97.86% <ø> (ø)
doctest 60.70% <ø> (-0.29%) ⬇️
unittests-3.10 96.29% <ø> (ø)
unittests-3.11 96.29% <ø> (ø)
unittests-3.8 96.31% <ø> (ø)
unittests-3.9 96.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@matthewfeickert matthewfeickert left a comment

Choose a reason for hiding this comment

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

@kratsg I have a minor suggestion for the infomration that gets printed to the user in the short test summary info for the skip, but other than that LGTM!

tests/conftest.py Outdated Show resolved Hide resolved
Copy link
Member

@matthewfeickert matthewfeickert left a comment

Choose a reason for hiding this comment

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

@kratsg My apologies. Though I've been rebasing this PR I didn't notice until tonight that you had responded to it 😬 — my bad.

If you don't like these suggested edits then we can merge this.

action="append",
type=str,
default=[],
choices=["tensorflow", "pytorch", "jax", "minuit"],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
choices=["tensorflow", "pytorch", "jax", "minuit"],
choices=["numpy", "tensorflow", "pytorch", "jax", "minuit"],

Is there a reason to not include numpy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Numpy is a core dependency, not an optional one.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but I would think that if I have the ability to disable backends during testing that I should be able to disable any of them, not just optional ones.

Copy link
Member

Choose a reason for hiding this comment

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

The point of the issue was to only disable optional ones.

That was the original case yes, but is there any technical reason to not want to also be able to skip numpy?

Copy link
Member

Choose a reason for hiding this comment

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

I don't want to delay this anymore so I'll merge this in and open an Issue.

tests/conftest.py Outdated Show resolved Hide resolved
kratsg and others added 2 commits October 5, 2023 07:23
Co-authored-by: Matthew Feickert <matthew.feickert@cern.ch>
@kratsg
Copy link
Contributor Author

kratsg commented Oct 5, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/enhancement New feature or request tests pytest user request Request coming form a pyhf user
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Supporting missing backends in tests
2 participants