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

run pytest with or without docs and notebooks in run_pytest.sh #569

Merged
merged 28 commits into from
Jan 6, 2025

Conversation

dorotat-nv
Copy link
Collaborator

@dorotat-nv dorotat-nv commented Jan 3, 2025

Description

We've streamlined our testing workflow to improve CI efficiency. By default, documentation tests and notebook validations are skipped to reduce pipeline duration.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor
  • Documentation update
  • Other (please describe): user guideline, updated to CI workflow

CI Pipeline Configuration

Configure CI behavior by checking relevant boxes below. This will automatically apply labels.

Note

By default, the notebooks validation tests are skipped unless explicitly enabled.

Usage

When running tests locally, use these flags to control test execution:

./ci/scripts/run_pytest.sh --skip-docs
./ci/scripts/run_pytest.sh --no-nbval
./ci/scripts/run_pytest.sh --no-nbval --skip-docs

Control test pipeline execution by adding these labels to your PR:
RUN_DOCS - Enables documentation testing
RUN_NOTEBOOKS_VALIDATION - Enables notebook validation

Pre-submit Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly
  • I have added/updated tests as needed
  • All existing tests pass successfully

@dorotat-nv
Copy link
Collaborator Author

/build-ci

@dorotat-nv
Copy link
Collaborator Author

/build-ci

1 similar comment
@dorotat-nv
Copy link
Collaborator Author

/build-ci

ci/scripts/run_pytest.sh Outdated Show resolved Hide resolved
@dorotat-nv dorotat-nv added documentation Improvements or additions to documentation and removed NOTEBOOKS labels Jan 3, 2025
@dorotat-nv
Copy link
Collaborator Author

/build-ci

@dorotat-nv dorotat-nv added tutorials-test and removed documentation Improvements or additions to documentation tutorials-test labels Jan 3, 2025
@dorotat-nv dorotat-nv changed the title run pytest with or without nbval in run_pytest.sh run pytest with or without docs in run_pytest.sh Jan 3, 2025
@dorotat-nv
Copy link
Collaborator Author

/build-ci

Copy link
Collaborator

@pstjohn pstjohn left a comment

Choose a reason for hiding this comment

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

awesome, LGTM, thanks!

ci/scripts/run_pytest.sh Outdated Show resolved Hide resolved
Copy link
Collaborator

@jstjohn jstjohn left a comment

Choose a reason for hiding this comment

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

Approved, but see my comment about the --nbval-lax argument. Maybe change the option to --skip-notebooks and if that's set then drop that kwarg.

@dorotat-nv dorotat-nv changed the title run pytest with or without docs in run_pytest.sh run pytest with or without docs and notebooks in run_pytest.sh Jan 6, 2025
@dorotat-nv dorotat-nv self-assigned this Jan 6, 2025
@dorotat-nv
Copy link
Collaborator Author

/build-ci

@dorotat-nv dorotat-nv enabled auto-merge (squash) January 6, 2025 13:47
@dorotat-nv
Copy link
Collaborator Author

/build-ci

Signed-off-by: dorotat-nv <dorotat@nvidia.com>
@dorotat-nv
Copy link
Collaborator Author

/build-ci

Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
@dorotat-nv
Copy link
Collaborator Author

/build-ci

@jstjohn
Copy link
Collaborator

jstjohn commented Jan 6, 2025

One thought: when you run docs, there is only notebook validation in there. I am a bit worried a user will add a notebook to docs, set RUN_NOTEBOOKS_VALIDATION and not realize they also need to add RUN_DOCS_VALIDATION if their notebook happens to be in the docs folder rather than a sub-module. Basically you currently support:

  • No notebook tests (default)
  • Only notebooks tests in sub-packages (if you say RUN_NOTEBOOKS_VALIDATION)
  • All notebooks tests (if you say both RUN_NOTEBOOKS_VALIDATION and RUN_DOCS_VALIDATION)

Note that only saying RUN_DOCS_VALIDATION would be more or less a no-op since the only tests in there are notebook tests so without RUN_NOTEBOOKS_VALIDATION also it would not do anything other than run the base tests in the sub-modules, which would be pretty confusing behavior given that option name.

My proposal would be to, for now, only have RUN_NOTEBOOKS_VALIDATION and have that option check in docs as well as sub-packages for notebooks to test. Thoughts? Also I don't think the argument would only run notebooks, it would include notebooks. So maybe the least confusing thing would be to say INCLUDE_NOTEBOOKS_VALIDATION and then it's clearer that all tests would run but notebooks would be included.

Signed-off-by: dorotat-nv <dorotat@nvidia.com>
@dorotat-nv
Copy link
Collaborator Author

/build-ci

Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
@github-actions github-actions bot added INCLUDE_NOTEBOOKS_TESTS Add Jupyter notebook validation to the CI pipeline and removed INCLUDE_NOTEBOOKS_TESTS Add Jupyter notebook validation to the CI pipeline labels Jan 6, 2025
Signed-off-by: dorotat-nv <dorotat@nvidia.com>
@github-actions github-actions bot added the INCLUDE_NOTEBOOKS_TESTS Add Jupyter notebook validation to the CI pipeline label Jan 6, 2025
@dorotat-nv
Copy link
Collaborator Author

/build-ci

@dorotat-nv dorotat-nv merged commit d34307b into main Jan 6, 2025
6 checks passed
@dorotat-nv dorotat-nv deleted the dorotat/pytest-nbval-on-demand branch January 6, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INCLUDE_NOTEBOOKS_TESTS Add Jupyter notebook validation to the CI pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants