Skip to content

Commit 78cada1

Browse files
authored
Merge pull request #475 from slayoo/readme_run_pytest
move README-code checking to a pytest test
2 parents e9a4a1b + d3714bd commit 78cada1

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,3 @@ script:
4444
- PYTEST="python$PY_SFX -m pytest $PY_FLAGS -p no:unraisableexception"
4545
- NUMBA_DISABLE_JIT=1 $PYTEST PySDM_tests/unit_tests --cov-report term --cov=PySDM # TODO #461
4646
- $PYTEST
47-
# execute Python lines from README.md # TODO #463
48-
- awk < README.md 'BEGIN {cmt=1; swp=0;} {swp=(substr($0,1,3)=="```"); if (swp && !cmt) {cmt=1; swp=0} if (cmt) print("#" $0); else print $0; if (swp && cmt) {cmt=0; swp=0}}' | python$PY_SFX $PY_FLAGS
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import exdown
2+
import pathlib
3+
4+
5+
test_readme = exdown.pytests(
6+
pathlib.Path(__file__).parent.parent.parent.joinpath("README.md").absolute(),
7+
syntax_filter="Python",
8+
encoding='utf8'
9+
)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ The key element of the PySDM interface is the [``Core``](https://github.com/atmo
146146
class which instances are used to manage the system state and control the simulation.
147147
Instantiation of the ``Core`` class is handled by the ``Builder``
148148
as exemplified below:
149+
<!--exdown-cont-->
149150
```Python
150151
from PySDM import Builder
151152
from PySDM.environments import Box
@@ -178,6 +179,7 @@ The ``run(nt)`` method advances the simulation by ``nt`` timesteps.
178179
In the listing below, its usage is interleaved with plotting logic
179180
which displays a histogram of particle mass distribution
180181
at selected timesteps:
182+
<!--exdown-cont-->
181183
```Python
182184
from PySDM.physics.constants import rho_w
183185
from matplotlib import pyplot

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
matplotlib>=3.2.2
33
ghapi
44
pytest
5+
exdown>=0.8.8
56

67
# note: if cloning both PySDM and PySDM examples, consider "pip install -e"
78
git+git://github.com/atmos-cloud-sim-uj/PySDM-examples

0 commit comments

Comments
 (0)