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

Refactor tests so that they fail when a dependency that should be installed is not installed #2922

Closed
freddyaboulton opened this issue Oct 14, 2021 · 0 comments · Fixed by #3126
Assignees
Labels
refactor Work being done to refactor code. testing Issues related to testing.

Comments

@freddyaboulton
Copy link
Contributor

This came out of out Sept B sprint retro. Our CI silently failed to install Prophet and we didn't notice because the Prophet tests didn't fail!

The reason they didn't fail is because we have pytest.import_or_skip at the top of the prophet test file. This means that the prophet tests were being skipped in the git-test-prophet job!

We should refactor our tests so that they fail when a dependency that should be installed is missing.

One way to do this is to move away from pytest.import_or_skip and instead leverage the --has-minimal-dependencies custom pytest option in our conftest.py to skip tests.

This will make it so that tests that need our optional dependencies are skipped when we run our core dependencies tests. When we run our core + optional dependencies tests, no tests should be skipped from missing dependencies.

We can follow this guide from the pytest documentation so that we can skip tests based on command line values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Work being done to refactor code. testing Issues related to testing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant