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 explanatory text on tests #124

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions content/docs/guide-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ os.environ['ODA_SECRET_STORAGE'] = '/secrets_custom'
It is a good practice to test the developed notebook. This allows to make sure that the code remains valid in the future.
A test is implemented as another notebook, except that name of the notebook starts with "test_". The notebook should call other notebooks and check that the output matches expectations. See an example of such a test [here](https://gitlab.renkulab.io/astronomy/mmoda/mmoda-nb2workflow-example/-/blob/master/notebooks/test_lightcurve.ipynb).

The test consists of:
1. load the nb2workflow runner (`from nb2workflow.nbadapter import run`)
2. prepare a dictionary of the input parameters (`par_dict={...}`)
3. running a notebook (`test_result = run('my_notebook.ipynb', par_dict)`)
4. accessing results from `test_result`, which is a dictionary whose keys are the names of the output variables (e.g. `result = test_result['result']`)
5. Make possible assessments on results

By default, tests do not include output processing by nb2workflow, which is achieved through the [dispatcher-plugin-nb2workflow](https://github.com/oda-hub/dispatcher-plugin-nb2workflow). To test the output ontology and formatting, it is necessary to add some dependencies to the basic environment: in `environment.yml`, add libmagic to the dependencies; in `requirements.txt` add the dispatcher and the`dispatcher-plugin-nb2workflow` from the corresponding git repositories as shown below
ferrigno marked this conversation as resolved.
Show resolved Hide resolved
```
git+https://github.com/oda-hub/dispatcher-app.git#egg=cdci_data_analysis
git+https://github.com/oda-hub/dispatcher-plugin-nb2workflow.git#egg=dispatcher-plugin-nb2workflow
```

### Reporting progress for long running tasks

In case your computation task runs considerable amount of time and can be split into stages
Expand Down
Loading