Merged
Conversation
Create a CI configuration with GitHub Actions that runs all the examples in CI, to see if all existing examples keep working when changes are made.
Owner
|
Thanks for this too. I was also thinking this kind of test is necessary. Really appreciated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request integrates pytest within our GitHub Actions CI pipeline to automatically execute all example scripts located in the
demos_and_examplesdirectory. This ensures that every commit or pull request can be verified that all existing examples keep working when changes are made.Changes
test_examples.py: A pytest wrapper script that dynamically discovers and runs each.pyfile indemos_and_examplesas a separate test case..github/workflows/python-app.yml: Configured the CI pipeline to set up pytest and run the wrapper script as part of the testing jobs.pytestto the project dependencies to enable automated test discovery and execution.How It Works
The
test_examples.pyscript utilizes pytest'spytest_generate_testshook to collect all the Python scripts in thedemos_and_examplesdirectory and parameterizes them as individual test cases. For each script, it uses Python'ssubprocessmodule to run the script as a separate process. The test is considered successful if the script runs to completion without errors (exit code 0).It already detected the first issue with the examples, which I reported in #28. If that is fixed everything should turn green. This PR can already be merged however.
Currently the tests take about 12 minutes, mainly due to the deep learning examples. Maybe we can speedup or exclude those in the future.