Skip to content

Commit af7ae0f

Browse files
committed
MERGE PYTEST into PLOT to parametrize TCs.
2 parents 1471551 + 4e55b30 commit af7ae0f

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ python:
44
- "2.7"
55
- "3.4"
66
- "3.5"
7+
78
addons:
89
apt:
910
packages:
@@ -13,13 +14,13 @@ addons:
1314
install:
1415
- pip install Sphinx sphinx_rtd_theme codecov packaging
1516
- "python -c $'import os, packaging.version as version\\nv = version.parse(os.environ.get(\"TRAVIS_TAG\", \"1.0\")).public\\nwith open(\"VERSION\", \"w\") as f: f.write(v)'"
16-
- pip install .[plot]
17+
- pip install -e .[test]
1718
- cd docs
1819
- make clean html
1920
- cd ..
2021

2122
script:
22-
- python setup.py nosetests --with-coverage --cover-package=graphkit
23+
- pytest -v --cov=graphkit
2324

2425
deploy:
2526
provider: pypi

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
"networkx == 2.2; python_version < '3.5'",
3434
],
3535
extras_require={
36-
'plot': ['pydot', 'matplotlib']
36+
'plot': ['pydot', 'matplotlib'],
37+
'test': ['pydot', 'matplotlib', 'pytest', "pytest-cov"],
3738
},
3839
tests_require=[
39-
"numpy",
40+
"pytest",
41+
"pytest-cov",
4042
"ipython; python_version >= '3.5'", # to test jupyter plot.
4143
"pydot", # to test plot
4244
"matplotlib" # to test plot

test/test_graphkit.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
from pprint import pprint
1313
from operator import add
14-
from numpy.testing import assert_raises
14+
15+
import pytest
1516

1617
import graphkit.network as network
1718
import graphkit.modifiers as modifiers
@@ -261,9 +262,10 @@ def test_pruning_raises_for_bad_output():
261262

262263
# Request two outputs we can compute and one we can't compute. Assert
263264
# that this raises a ValueError.
264-
assert_raises(ValueError, net, {'a': 1, 'b': 2, 'c': 3, 'd': 4},
265-
outputs=['sum1', 'sum3', 'sum4'])
266-
265+
with pytest.raises(ValueError) as exinfo:
266+
net({'a': 1, 'b': 2, 'c': 3, 'd': 4},
267+
outputs=['sum1', 'sum3', 'sum4'])
268+
assert exinfo.match('sum4')
267269

268270
def test_optional():
269271
# Test that optional() needs work as expected.

0 commit comments

Comments
 (0)