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

Enable running subsets of notebook tests #6

Closed
phoevos opened this issue Aug 1, 2023 · 0 comments · Fixed by #18
Closed

Enable running subsets of notebook tests #6

phoevos opened this issue Aug 1, 2023 · 0 comments · Fixed by #18
Assignees
Labels
enhancement New feature or request

Comments

@phoevos
Copy link
Contributor

phoevos commented Aug 1, 2023

Currently, we rely on dynamic test discovery to determine the set of notebooks to be executed as part of the test suite. More specifically, we look inside the notebooks directory (and its nested directories) for any Python notebook files (i.e. .ipynb), which we then use as input for pytest's parametrize to generate a test for each notebook.

The above means that all tests found inside the notebooks directory will be executed when pytest runs.

Goal

Enable specifying subsets of the notebook tests to run.

Solution

pytest CLI offers the -k option, which can be used to filter tests by keyword expressions (substring matching on names).

Let's assume we have the following notebooks:

  1. kfp-integration.ipynb
  2. kfp-minio-integration.ipynb
  3. minio-integration.ipynb

Then we have the following options:

  • Running pytest executes all three
  • Running pytest -k 'kfp' executes 1 and 2
  • Running pytest -k 'kfp and not minio' executes 1

This is possible because we use the notebook name as an ID when parametrizing the suite, which adds it to the test case name.

@phoevos phoevos added the enhancement New feature or request label Aug 1, 2023
@phoevos phoevos self-assigned this Aug 1, 2023
@phoevos phoevos changed the title Enable running subsets of the notebook tests Enable running subsets of notebook tests Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant