mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-09 02:54:05 +00:00
Update tests.md for new test directories
This commit is contained in:
@@ -4,17 +4,17 @@ We greatly appreciate Pull Requests that extend the automated tests that vet the
|
|||||||
|
|
||||||
## How the Tests Work
|
## How the Tests Work
|
||||||
|
|
||||||
A [GitHub Action workflow](https://github.com/jupyter/docker-stacks/blob/main/.github/workflows/docker.yml)
|
A [GitHub Action workflow](https://github.com/jupyter/docker-stacks/blob/main/.github/workflows/docker-build-test-upload.yml)
|
||||||
runs tests against pull requests submitted to the `jupyter/docker-stacks` repository.
|
runs tests against pull requests submitted to the `jupyter/docker-stacks` repository.
|
||||||
|
|
||||||
We use the `pytest` module to run tests on the image.
|
We use the `pytest` module to run tests on the image.
|
||||||
`conftest.py` and `pytest.ini` in the `tests` folder define the environment in which tests are run.
|
`conftest.py` and `pytest.ini` in the `tests` folder define the environment in which tests are run.
|
||||||
More info on `pytest` can be found [here](https://docs.pytest.org/en/latest/contents.html).
|
More info on `pytest` can be found [here](https://docs.pytest.org/en/latest/contents.html).
|
||||||
|
|
||||||
The actual image-specific test files are located in folders like `tests/<somestack>/` (e.g., `tests/docker-stacks-foundation/`, `tests/minimal-notebook/`, etc.).
|
The actual image-specific test files are located in folders like `tests/by_image/<somestack>/` (e.g., `tests/by_image/docker-stacks-foundation/`, etc.).
|
||||||
|
|
||||||
```{note}
|
```{note}
|
||||||
If your test is located in `tests/<somestack>/`, it will be run against the `jupyter/<somestack>` image and against all the [images inherited from this image](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#image-relationships.
|
If your test is located in `tests/by_image/<somestack>/`, it will be run against the `jupyter/<somestack>` image and against all the [images inherited from this image](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#image-relationships).
|
||||||
```
|
```
|
||||||
|
|
||||||
Many tests make use of global [pytest fixtures](https://docs.pytest.org/en/latest/reference/fixtures.html)
|
Many tests make use of global [pytest fixtures](https://docs.pytest.org/en/latest/reference/fixtures.html)
|
||||||
@@ -23,15 +23,15 @@ defined in the [conftest.py](https://github.com/jupyter/docker-stacks/blob/main/
|
|||||||
## Unit tests
|
## Unit tests
|
||||||
|
|
||||||
You can add a unit test if you want to run a Python script in one of our images.
|
You can add a unit test if you want to run a Python script in one of our images.
|
||||||
You should create a `tests/<somestack>/units/` directory, if it doesn't already exist, and put your file there.
|
You should create a `tests/by_image/<somestack>/units/` directory, if it doesn't already exist, and put your file there.
|
||||||
Files in this folder will be executed in the container when tests are run.
|
Files in this folder will be executed in the container when tests are run.
|
||||||
You can see an [TensorFlow package example here](https://github.com/jupyter/docker-stacks/blob/HEAD/tests/tensorflow-notebook/units/unit_tensorflow.py).
|
You can see an [TensorFlow package example here](https://github.com/jupyter/docker-stacks/blob/HEAD/tests/by_image/tensorflow-notebook/units/unit_tensorflow.py).
|
||||||
|
|
||||||
## Contributing New Tests
|
## Contributing New Tests
|
||||||
|
|
||||||
Please follow the process below to add new tests:
|
Please follow the process below to add new tests:
|
||||||
|
|
||||||
1. Add your test code to one of the modules in the `tests/<somestack>/` directory or create a new module.
|
1. Add your test code to one of the modules in the `tests/by_image/<somestack>/` directory or create a new module.
|
||||||
2. Build one or more images you intend to test and run the tests locally.
|
2. Build one or more images you intend to test and run the tests locally.
|
||||||
If you use `make`, call:
|
If you use `make`, call:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user