Skip to content

Commit

Permalink
Add tox as test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Apr 23, 2020
1 parent 73511cb commit 70137fb
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 52 deletions.
22 changes: 16 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
language: python

python:
- "3.6"
- "3.7"
- "2.7"

virtualenv:
system_site_packages: false

compiler:
- gcc

matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: 3.7
env: TOXENV=formatting

os:
- linux

Expand Down Expand Up @@ -43,6 +51,7 @@ install:
- popd
- git clone --branch $LIBRES_VERSION --depth 1 https://github.com/equinor/libres
- pushd libres
- pip install -r requirements.txt --prefix=$INSTALL_DIR
- source .libecl_version
- export LIBRES_TEST_DATA_DIR="$(pwd)/test-data"
- popd
Expand All @@ -53,9 +62,10 @@ install:
- export PYTHONPATH=$INSTALL_DIR/lib/python$TRAVIS_PYTHON_VERSION/site-packages:$PYTHONPATH
- PATH=$INSTALL_DIR/bin:$PATH
- pip install ert/ --prefix=$INSTALL_DIR
- pip install tox

script:
- python setup.py test
- tox

deploy:
- provider: pypi
Expand Down
6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

10 changes: 1 addition & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,7 @@ def package_files(directory):
"stea",
"pyscal>=0.4.0",
],
setup_requires=["pytest-runner", "setuptools_scm"],
tests_require=[
"pytest",
"mock",
'openpyxl<=2.6.4; python_version<="2.7"',
'openpyxl; python_version>="3.6"',
'black; python_version>="3.6"',
],
test_suite="tests",
setup_requires=["setuptools_scm"],
package_data={"": job_files},
include_package_data=True,
)
5 changes: 4 additions & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pytest
mock
black; python_version>="3.6"
zipp<2; python_version<='2.7'
configparser<5; python_version<='2.7'
openpyxl<=2.6.4; python_version<="2.7"
openpyxl; python_version>="3.6"
30 changes: 0 additions & 30 deletions tests/test_formatting.py

This file was deleted.

24 changes: 24 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tox]
envlist =
py27
py37
formatting

[testenv]
deps = -rtest_requirements.txt
# The two following lines are a bit ugly,
# but is required until ert and libres are
# pip installable
passenv = PYTHONPATH LIBRES_TEST_DATA_DIR
sitepackages = true
commands = pytest

[testenv:formatting]
description = Invoke black to format the code
deps =
black
commands =
black --check semeio tests setup.py

[pytest]
addopts = tests

0 comments on commit 70137fb

Please sign in to comment.