From 617e577ecf76fa8273934ff047013ebae97a8cfc Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sat, 28 Sep 2019 18:02:46 +0300 Subject: [PATCH 1/4] FIX(build): py2 needs pinning networkx-2.2 --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd7883f4..d3dfec84 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,10 @@ author_email='huyng@yahoo-inc.com', url='http://github.com/yahoo/graphkit', packages=['graphkit'], - install_requires=['networkx'], + install_requires=[ + "networkx; python_version >= '3.5'", + "networkx == 2.2; python_version < '3.5'", + ], extras_require={ 'plot': ['pydot', 'matplotlib'] }, From 32409f6342b5dc136c1c6d150171a2abe9912a3e Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Thu, 3 Oct 2019 20:34:44 +0300 Subject: [PATCH 2/4] enh(build): replace numpy with pytest... numpy was used just for its assert_raise --- setup.py | 2 +- test/test_graphkit.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index d3dfec84..d4b7c378 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ extras_require={ 'plot': ['pydot', 'matplotlib'] }, - tests_require=['numpy'], + tests_require=['pytest'], license='Apache-2.0', keywords=['graph', 'computation graph', 'DAG', 'directed acyclical graph'], classifiers=[ diff --git a/test/test_graphkit.py b/test/test_graphkit.py index bd97b317..7db2e973 100644 --- a/test/test_graphkit.py +++ b/test/test_graphkit.py @@ -6,7 +6,8 @@ from pprint import pprint from operator import add -from numpy.testing import assert_raises + +import pytest import graphkit.network as network import graphkit.modifiers as modifiers @@ -180,9 +181,10 @@ def test_pruning_raises_for_bad_output(): # Request two outputs we can compute and one we can't compute. Assert # that this raises a ValueError. - assert_raises(ValueError, net, {'a': 1, 'b': 2, 'c': 3, 'd': 4}, - outputs=['sum1', 'sum3', 'sum4']) - + with pytest.raises(ValueError) as exinfo: + net({'a': 1, 'b': 2, 'c': 3, 'd': 4}, + outputs=['sum1', 'sum3', 'sum4']) + assert exinfo.match('sum4') def test_optional(): # Test that optional() needs work as expected. From f606ed1f147cba8956012c0a35475af052bcd361 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Thu, 3 Oct 2019 20:35:56 +0300 Subject: [PATCH 3/4] feat(build): add pip-extras [test] --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d4b7c378..51d606fc 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,8 @@ "networkx == 2.2; python_version < '3.5'", ], extras_require={ - 'plot': ['pydot', 'matplotlib'] + 'plot': ['pydot', 'matplotlib'], + 'test': ['pydot', 'matplotlib', 'pytest'], }, tests_require=['pytest'], license='Apache-2.0', From 4e55b30310d04660c53553bb9e2e87669271b9bd Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Thu, 3 Oct 2019 20:54:53 +0300 Subject: [PATCH 4/4] enh(build,ci): use pytest in travis --- .travis.yml | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d8657a8f..bb7d875e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,13 @@ python: install: - pip install Sphinx sphinx_rtd_theme codecov packaging - "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)'" - - python setup.py install + - pip install -e .[test] - cd docs - make clean html - cd .. script: - - python setup.py nosetests --with-coverage --cover-package=graphkit + - pytest -v --cov=graphkit deploy: provider: pypi diff --git a/setup.py b/setup.py index 51d606fc..c8d231a5 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,9 @@ ], extras_require={ 'plot': ['pydot', 'matplotlib'], - 'test': ['pydot', 'matplotlib', 'pytest'], + 'test': ['pydot', 'matplotlib', 'pytest', "pytest-cov"], }, - tests_require=['pytest'], + tests_require=['pytest', "pytest-cov"], license='Apache-2.0', keywords=['graph', 'computation graph', 'DAG', 'directed acyclical graph'], classifiers=[