Skip to content

Commit c378bc1

Browse files
committed
Move tests to separate folder and add them to CI config. Update information in setup.py.
1 parent cfd4cae commit c378bc1

4 files changed

Lines changed: 40 additions & 28 deletions

File tree

DEV_README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@ git clone --branch develop --recursive https://github.com/ScientificDataFormat/S
88

99
## Build the archive
1010

11-
To build the binaries and distribution archive run the respective build script.
11+
To build the binaries and distribution archive run the respective build script for your platform.
1212

13-
- Windows: build_windows.bat
14-
- Linux: build_linux.sh
15-
- Mac: build_mac.sh
13+
- build_windows.bat
14+
- build_linux.sh
15+
- build_mac.sh
1616

1717
## Install the package
1818

1919
```
2020
cd SDF-Python
2121
pip install .
2222
```
23+
24+
## Run the tests
25+
26+
cd tests
27+
python -m unitests

appveyor.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,25 @@ build: false
55
install:
66
- cmd: git submodule update --init --recursive
77

8+
9+
environment:
10+
matrix:
11+
- PYTHON_VERSION: 3.4
12+
MINICONDA: C:\Miniconda3
13+
14+
init:
15+
- "echo %PYTHON_VERSION% %MINICONDA%"
16+
17+
install:
18+
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
19+
- conda config --set always_yes yes --set changeps1 no
20+
- conda update -q conda
21+
- conda info -a
22+
- "conda create -q -n test-environment python=%PYTHON_VERSION% numpy h5py matplotlib scipy"
23+
- activate test-environment
24+
- pip install dymat
25+
826
test_script:
927
- build_windows
28+
- cd tests
29+
- python -m unittests

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from distutils.core import setup
1+
from setuptools import setup
22

3-
setup(name="sdf",
3+
setup(name="SDF",
44
version="0.3.1",
55
description="Scientific Data Format",
6-
url="",
7-
author="",
8-
author_email="",
6+
url="https://github.com/ScientificDataFormat/SDF-Python",
7+
author="Torsten Sommer",
8+
author_email="torsten.sommer@3ds.com",
99
license="Standard 3-clause BSD",
1010
packages=["sdf", "sdf.examples", "sdf.plot"],
1111
package_data={"sdf": ["examples/IntegerNetwork1.mat", "win32/ndtable.dll", "win64/ndtable.dll", "linux64/libndtable.so", "darwin64/libNDTable.dylib"]},

sdf/test.py renamed to tests/test_sdf.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_validate_dataset(self):
234234
self.assertEqual(["Scales must be strictly monotonic increasing"], errors)
235235

236236
def test_dsres_load_all(self):
237-
path, _ = os.path.split(__file__)
237+
path, _ = os.path.split(sdf.__file__)
238238
filename = os.path.join(path, 'examples', 'IntegerNetwork1.mat')
239239

240240
g = sdf.load(filename)
@@ -266,7 +266,7 @@ def test_dsres_load_all(self):
266266

267267
def test_dsres_load_dataset(self):
268268

269-
path, _ = os.path.split(__file__)
269+
path, _ = os.path.split(sdf.__file__)
270270
filename = os.path.join(path, 'examples', 'IntegerNetwork1.mat')
271271

272272
ds = sdf.load(filename, objectname='/booleanPulse2/period')
@@ -292,30 +292,17 @@ def test_dsres_load_dataset(self):
292292
self.assertEqual(ds.data.dtype, np.int32)
293293
self.assertEqual(ds.data, 1)
294294

295-
# def test_excel2sdf_example(self):
296-
# path, _ = os.path.split(__file__)
297-
# filename = os.path.join(path, 'examples', 'excel2sdf.py')
298-
# runpy.run_path(filename)
299-
300295
def test_interp_1d_example(self):
301-
path, _ = os.path.split(__file__)
302-
filename = os.path.join(path, 'examples', 'interp_1d.py')
303-
runpy.run_path(filename)
296+
runpy.run_module('sdf.examples.interp_1d')
304297

305298
def test_interp_2d_example(self):
306-
path, _ = os.path.split(__file__)
307-
filename = os.path.join(path, 'examples', 'interp_2d.py')
308-
runpy.run_path(filename)
299+
runpy.run_module('sdf.examples.interp_2d')
309300

310301
def test_sine_example(self):
311-
path, _ = os.path.split(__file__)
312-
filename = os.path.join(path, 'examples', 'sine.py')
313-
runpy.run_path(filename)
302+
runpy.run_module('sdf.examples.sine')
314303

315304
def test_spline_1d_example(self):
316-
path, _ = os.path.split(__file__)
317-
filename = os.path.join(path, 'examples', 'spline_1d.py')
318-
runpy.run_path(filename)
305+
runpy.run_module('sdf.examples.spline_1d')
319306

320307
if __name__ == "__main__":
321308
unittest.main()

0 commit comments

Comments
 (0)