From 840b8ff011394d7751cbc3e1e2ee9447f0c30286 Mon Sep 17 00:00:00 2001 From: ConnectedSystems Date: Fri, 6 Mar 2020 21:25:26 +1100 Subject: [PATCH 1/3] Update travis and package config `python setup.py test` raises a deprecation warning stating that the test runner (pytest) should be called directly. package setup.cfg updated to enable this change Updated travis config while I was at it as tests/builds are failing for Py3.5 as SALib now uses features only found in 3.6 onwards. --- .travis.yml | 5 +++-- docs/getting-started.rst | 4 ++-- setup.cfg | 7 ++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01f0b5fa..7fd139c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,13 @@ sudo: false language: python env: matrix: - - DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="true" - - DISTRIB="conda" PYTHON_VERSION="3.6" COVERAGE="false" + - DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="false" + - DISTRIB="conda" PYTHON_VERSION="3.6" COVERAGE="true" - DISTRIB="conda" PYTHON_VERSION="3.7" COVERAGE="false" - DISTRIB="conda" PYTHON_VERSION="3.8" COVERAGE="false" matrix: allow_failures: + - env: DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="false" - env: DISTRIB="conda" PYTHON_VERSION="3.8" COVERAGE="false" addons: apt: diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 1fc08c9e..6aeaa03c 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -50,7 +50,7 @@ To test your installation of SALib, run the following command :: - python setup.py test + pytest Alternatively, if you’d like also like a taste of what SALib provides, start a new interactive Python session @@ -82,7 +82,7 @@ and copy/paste the code below. Si = sobol.analyze(problem, Y, print_to_console=True) # Print the first-order sensitivity indices - print Si['S1'] + print(Si['S1']) If installed correctly, the last line above will print three values, similar to :code:`[ 0.30644324 0.44776661 -0.00104936]`. \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 3e245bdf..c173ae1a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,6 +48,9 @@ exclude = # Add here additional requirements for extra features, to install with: # `pip install SALib[PDF]` like: gurobipy = gurobipy +testing = + pytest + pytest-cov [options.entry_points] console_scripts = @@ -64,7 +67,8 @@ console_scripts = [test] # py.test options when running `python setup.py test` -addopts = tests +# addopts = tests +extras = True [tool:pytest] # Options for py.test: @@ -77,6 +81,7 @@ norecursedirs = dist build .tox +testpaths = tests [aliases] release = sdist bdist_wheel upload From 60bd73670ac30068d1bca03dafdbb523dac87ed2 Mon Sep 17 00:00:00 2001 From: ConnectedSystems Date: Fri, 6 Mar 2020 21:31:41 +1100 Subject: [PATCH 2/3] Updated test instructions --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a175f475..12c96115 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ First, create a new issue on Github with the label `bug`. Use this to describe t Then, please create a new branch with the name `bug_xxx` where xxx is the number of the issue. -If possible, write a test which reproduces the bug. The tests are stored in the `SALib/tests/` folder, and are run using `pytest`. You can run the tests with the command `python setup.py test` from the root folder of the library. +If possible, write a test which reproduces the bug. The tests are stored in the `SALib/tests/` folder, and are run using `pytest` from the root folder of the library. You can run the tests with the command `python setup.py test`. Then, fix the bug in the code so that the test passes. From ee7536f58920bc7de99b2f2add8df83f91cde4a5 Mon Sep 17 00:00:00 2001 From: ConnectedSystems Date: Fri, 6 Mar 2020 21:33:00 +1100 Subject: [PATCH 3/3] update test script command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7fd139c7..2696cb52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: - pip install -r test-requirements.txt script: - python setup.py develop -- python setup.py test +- pytest after_success: - if [[ "$COVERAGE" == "true" ]]; then coveralls || echo "failed"; fi notifications: