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

Skip to content

test: skip tests if the required packages are not installed #170

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 4 commits into from
Jul 19, 2024

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Jan 25, 2024

As per the snippet below, tests in test_lower_bound_checker.py require that specific packages in tests/unit/resources be installed in the same environment. If those packages don't exist during test time, we should mark the test as skipped.

# These packages are installed into the environment by the nox session
# See 'resources/' for the setup.py files
GOOD_PACKAGE = "valid-package"
BAD_PACKAGE = "invalid-package"

Fixes #168 🦕

@parthea parthea requested a review from a team as a code owner January 25, 2024 21:11
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Jan 25, 2024
@parthea parthea mentioned this pull request Jan 25, 2024
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jan 26, 2024
@parthea parthea force-pushed the skip-tests-if-required-package-is-not-installed branch from ae67dee to ebba1c8 Compare January 26, 2024 21:10
@@ -34,9 +41,19 @@
BAD_PACKAGE = "invalid-package"


def skip_test_if_not_installed(package_name: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Style note: this could be a decorator for each test function, and pass the package name to the test function, so we only hard-code it once.

Not a blocker by any means.

@vchudnov-g vchudnov-g merged commit 73c7668 into main Jul 19, 2024
21 checks passed
@vchudnov-g vchudnov-g deleted the skip-tests-if-required-package-is-not-installed branch July 19, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 tests fail
2 participants