Skip to content

Commit fe0ae16

Browse files
authored
📚 DOCS: Add usage description for pytest CLI in README (chrisjsewell#22)
1 parent 2d763d0 commit fe0ae16

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@ To install the development version:
7272

7373
See the documentation at: http://pytest-notebook.readthedocs.io/
7474

75+
If you want to test some sample notebooks, add the `--nb-test-files` flag:
76+
77+
```shell
78+
>> git clone https://github.com/chrisjsewell/pytest-notebook
79+
>> cd pytest-notebook/samples
80+
>> pip install pytest ipykernel pytest-notebook
81+
>> pytest --nb-test-files *.ipynb
82+
```
83+
84+
You should see `success.ipynb` passed the test and `fail.ipynb` failed the test.
85+
86+
You can regenerate the outputs of `fail.ipynb` with the `--nb-force-regen` flag:
87+
88+
```shell
89+
>> pytest --nb-test-files --nb-force-regen *.ipynb
90+
```
91+
7592
## Contributing
7693

7794
Contributions are very welcome.

examples/fail.ipynb

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"B\n"
13+
]
14+
}
15+
],
16+
"source": [
17+
"print(\"A\")"
18+
]
19+
}
20+
],
21+
"metadata": {
22+
"language_info": {
23+
"codemirror_mode": {
24+
"name": "ipython",
25+
"version": 3
26+
},
27+
"file_extension": ".py",
28+
"mimetype": "text/x-python",
29+
"name": "python",
30+
"nbconvert_exporter": "python",
31+
"pygments_lexer": "ipython3",
32+
"version": "3.8.12"
33+
}
34+
},
35+
"nbformat": 4,
36+
"nbformat_minor": 2
37+
}

examples/pytest.ini

Whitespace-only changes.

examples/success.ipynb

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"A\n"
13+
]
14+
}
15+
],
16+
"source": [
17+
"print(\"A\")"
18+
]
19+
}
20+
],
21+
"metadata": {
22+
"language_info": {
23+
"codemirror_mode": {
24+
"name": "ipython",
25+
"version": 3
26+
},
27+
"file_extension": ".py",
28+
"mimetype": "text/x-python",
29+
"name": "python",
30+
"nbconvert_exporter": "python",
31+
"pygments_lexer": "ipython3",
32+
"version": "3.8.12"
33+
}
34+
},
35+
"nbformat": 4,
36+
"nbformat_minor": 2
37+
}

0 commit comments

Comments
 (0)