Skip to content

Commit 8449a76

Browse files
committed
TST: Make script to run all test scripts; use it on Travis-CI
1 parent 94ee08e commit 8449a76

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ install:
1313
- pip install .
1414
- pip install -r tests/requirements.txt
1515
- pip install -r doc/requirements.txt
16+
# This is needed in example scripts:
17+
- pip install pillow
1618
script:
1719
- python -m pytest
20+
- python doc/examples/run_all.py
1821
# This executes the example notebooks:
1922
- python -m sphinx doc/ _build/ -b dummy

doc/examples/run_all.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
from pathlib import Path
3+
import subprocess
4+
import sys
5+
6+
if __name__ != '__main__':
7+
raise ImportError(__name__ + ' is not meant be imported')
8+
9+
self = Path(__file__)
10+
cwd = self.parent
11+
12+
for script in cwd.glob('*.py'):
13+
if self == script:
14+
# Don't call yourself!
15+
continue
16+
print('Running', script, '...')
17+
args = [sys.executable, str(script.relative_to(cwd))] + sys.argv[1:]
18+
result = subprocess.run(args, cwd=str(cwd))
19+
if result.returncode:
20+
print('Error running', script, file=sys.stderr)
21+
sys.exit(result.returncode)

doc/examples/sound_field_synthesis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#x0, n0, a0 = sfs.array.linear_random(N, 0.2*dx, 5*dx)
3434
#x0, n0, a0 = sfs.array.rectangular(N, dx, orientation=sfs.util.direction_vector(0*np.pi/4, np.pi/2))
3535
#x0, n0, a0 = sfs.array.circular(N, R)
36-
x0, n0, a0 = sfs.array.load('../data/arrays/university_rostock.csv')
36+
x0, n0, a0 = sfs.array.load('../../data/arrays/university_rostock.csv')
3737

3838
#x0, n0, a0 = sfs.array.planar(N, dx, orientation=sfs.util.direction_vector(np.radians(0),np.radians(180)))
3939
#x0, n0, a0 = sfs.array.cube(N, dx, orientation=sfs.util.direction_vector(0, np.pi/2))

0 commit comments

Comments
 (0)