Skip to content

Commit

Permalink
Merge pull request #203 from Jacob-Stevens-Haas/notebook-tests
Browse files Browse the repository at this point in the history
TST: Add Notebook tests
  • Loading branch information
Jacob-Stevens-Haas authored Jul 11, 2022
2 parents 59d24ba + 285b02c commit d0d96f4
Show file tree
Hide file tree
Showing 18 changed files with 2,283 additions and 1,461 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
pip install sympy # needed for notebook 9, but not required for pysindy
- name: Test with pytest
run: |
pytest test --cov=pysindy --cov-report=xml
Expand Down
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ Contributing examples
^^^^^^^^^^^^^^^^^^^^^
We love seeing examples of PySINDy being used to solve interesting problems! If you would like to contribute an example, reach out to us by creating an issue.

At a minimum, we need to be able to run the example notebooks in the normal mode as well as in a test mode that uses smaller data in order to run faster and simply verify that cells execute without error. In order to do that, your example should obey the following directory tree

.. code-block::
./<name_of_example>/
\
|-example.py # save your notebook as a python script
|-example_data.py # has functions to create/load data
|-mock_data.py # has functions with same name as in example_data.py which create/load smaller datasets
|-example.ipynb # run python examples/publish_notebook/<name_of_example> to generate this. Needs packages in requirements-dev.txt
|-other files, if required (helper module, data, etc)
You can optimize your notebook for testing by checking ``__name__``. When our tests run ``example.py`` they set the ``__name__`` global to ``"testing"``. For instance, your notebook should determine whether to import from ``mock_data`` or ``example_data`` using this method.

Contributing code
^^^^^^^^^^^^^^^^^
We welcome contributions to PySINDy. To contribute a new feature please submit a pull request. To get started we recommend installing the packages in ``requirements-dev.txt`` via
Expand Down
Loading

0 comments on commit d0d96f4

Please sign in to comment.