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

Add integration test for notebooks #389

Closed
wants to merge 423 commits into from
Closed

Add integration test for notebooks #389

wants to merge 423 commits into from

Conversation

thejumpman2323
Copy link
Contributor

@thejumpman2323 thejumpman2323 commented Jul 8, 2023

Solves a task in #135

This pull request introduces an integration test that automates the conversion of Jupyter notebooks to Python files and runs them individually as tests. This integration test enhances our testing infrastructure by providing a streamlined process for verifying the functionality and correctness of Jupyter notebook conversions.

Changes Made

Added a new integration test module test_notebooks.py which performs the Jupyter notebook to Python file conversion and execution.
Implemented the necessary logic to convert Jupyter notebooks to Python files using the nbconvert library.
Configured the test module to execute the converted Python files as individual tests using the testing framework.

Test Execution Flow

The integration test module test_notebooks.py locates the target Jupyter notebook files.
Each notebook file is automatically converted to a corresponding Python file using the nbconvert library.
The converted Python files are executed individually as tests, ensuring their correctness and functionality.
Test results, including any failures or errors, are reported in the test execution summary.

Benefits

Automation: The integration test automates the process of converting Jupyter notebooks to Python files and executing them as tests.
Verification: This test ensures that Jupyter notebook conversions produce valid Python code that can be executed successfully.
Continuous Integration: The integration test can be incorporated into our CI/CD pipeline to catch potential issues early in the development process.
Improved Code Reliability: Running Jupyter notebooks as tests helps identify any code inconsistencies or errors during conversion, leading to more reliable code.
This integration test contributes to the overall quality and reliability of our codebase, enabling us to confidently convert Jupyter notebooks to Python files and validate their correctness through automated testing.

GitHub Actions SuperDuperDB and others added 30 commits March 29, 2023 15:16
renamed all mentions of urls to uris to enable s3 support
…-print-statements

Feature/50/logger instead of print statements
…data-types-for-major-use-cases

added common data types
…ask-if-fails

handled error in case learning task, deleting original task
@thejumpman2323 thejumpman2323 requested a review from blythed July 8, 2023 14:33
@thejumpman2323 thejumpman2323 self-assigned this Jul 8, 2023
@thejumpman2323 thejumpman2323 marked this pull request as draft July 8, 2023 17:07
@fkiraly
Copy link

fkiraly commented Jul 10, 2023

Great PR summary, @thejumpman2323!
I immediately get what we're doing here and that allows me to make hopefully useful comments.

FYI, in case it helps (I think this is still WiP?) the same type of workflow in sktime are here:

It's interesting how you do the same thing, but from within python / pytest.

Question: would it be cleaner if it is its own CI element (like in sktime)?

@thejumpman2323 call logic: GHA -> pytest -> python -> jupyter -> python
sktime call logic: GHA -> sh -> jupyter -> python

@thejumpman2323
Copy link
Contributor Author

Great PR summary, @thejumpman2323! I immediately get what we're doing here and that allows me to make hopefully useful comments.

FYI, in case it helps (I think this is still WiP?) the same type of workflow in sktime are here:

It's interesting how you do the same thing, but from within python / pytest.

Question: would it be cleaner if it is its own CI element (like in sktime)?

@thejumpman2323 call logic: GHA -> pytest -> python -> jupyter -> python sktime call logic: GHA -> sh -> jupyter -> python

Hi,
This make sense, creating separate ci for integration tests on notebooks!
Thanks

completed_process = subprocess.run(['python3', os.path.join(tmp_dir, py_file_path)], capture_output=True, text=True, timeout=10)
assert completed_process.returncode == 0

def test_notebooks():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would prefer this to be configured manually - some notebooks won't work without credentials, etc..
Could we do just the mnist initially?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We would need a test account for openAI, and secrets management on GitHub.

@rec rec force-pushed the main branch 2 times, most recently from bf5f0c5 to 0f516a0 Compare July 11, 2023 09:50
@thejumpman2323 thejumpman2323 added the 📉 technical debt Things that slow us down label Jul 11, 2023
@rec rec closed this Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📉 technical debt Things that slow us down
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants