Skip to content

Commit d0d96f4

Browse files
Merge pull request #203 from Jacob-Stevens-Haas/notebook-tests
TST: Add Notebook tests
2 parents 59d24ba + 285b02c commit d0d96f4

File tree

18 files changed

+2283
-1461
lines changed

18 files changed

+2283
-1461
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- name: Install dependencies
3535
run: |
3636
pip install -r requirements-dev.txt
37+
pip install sympy # needed for notebook 9, but not required for pysindy
3738
- name: Test with pytest
3839
run: |
3940
pytest test --cov=pysindy --cov-report=xml

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,20 @@ Contributing examples
157157
^^^^^^^^^^^^^^^^^^^^^
158158
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.
159159

160+
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
161+
162+
.. code-block::
163+
164+
./<name_of_example>/
165+
\
166+
|-example.py # save your notebook as a python script
167+
|-example_data.py # has functions to create/load data
168+
|-mock_data.py # has functions with same name as in example_data.py which create/load smaller datasets
169+
|-example.ipynb # run python examples/publish_notebook/<name_of_example> to generate this. Needs packages in requirements-dev.txt
170+
|-other files, if required (helper module, data, etc)
171+
172+
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.
173+
160174
Contributing code
161175
^^^^^^^^^^^^^^^^^
162176
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

0 commit comments

Comments
 (0)