Removing tox for clarity in CI and tests

This commit is contained in:
Felipe Jin 2021-04-02 22:46:55 +01:00 committed by George Kadianakis
parent 95bd083109
commit ba4727721d
9 changed files with 39 additions and 47 deletions

1
.gitignore vendored
View File

@ -34,7 +34,6 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml

View File

@ -1,22 +1,26 @@
language: python
sudo: required
dist: bionic
python: 3.9
python: 3.7
env:
- TOXENV=py39 TEST=unit
- TOXENV=style
- TOXENV=docs
- TEST=unit
before_install:
# Install tor and chutney if doing functional tests
- if [[ $TEST == functional* ]]; then ./test/scripts/install-tor.sh; fi
- if [[ $TEST == 'functional_v2' ]]; then source test/scripts/install-chutney-v2.sh; fi
- if [[ $TEST == 'functional_v3' ]]; then source test/scripts/install-chutney-v3.sh; fi
install:
- pip install tox coveralls
- pip install -r requirements.txt
- pip install -r test-requirements.txt
script:
- if [[ $TEST == 'functional_v2' ]]; then tox ./test/functional/v2/;
elif [[ $TEST == 'functional_v3' ]]; then tox ./test/functional/v3/;
elif [[ $TEST == 'unit' ]]; then tox -- --ignore=./test/functional/;
else tox; fi
# Tests are run with linters
- if [[ $TEST == functional* ]];
then
source ./test/scripts/run-functional-tests.sh;
elif [[ $TEST == 'unit' ]];
then
source ./test/scripts/run-unit-tests.sh;
fi
- sphinx-build -W -b html -d ./docs/_build ./docs ./docs/_build/html
after_success:
- coveralls

View File

@ -1,7 +1,6 @@
include README.rst
include COPYING
include requirements.txt
include tox.ini
recursive-include docs *.rst
recursive-include onionbalance/config_generator/data *
include versioneer.py

View File

@ -1,5 +1,5 @@
[tool:pytest]
norecursedirs = .tox _build tor chutney
norecursedirs = _build tor chutney
[bdist_wheel]
universal=1
@ -10,4 +10,8 @@ style = pep440
versionfile_source = onionbalance/_version.py
versionfile_build = onionbalance/_version.py
tag_prefix =''
parentdir_prefix = onionbalance-
parentdir_prefix = onionbalance-
[flake8]
ignore = E501, E302, E251, E305, E261
exclude = onionbalance/hs_v3/ext/

View File

@ -50,8 +50,8 @@ setup(
'future>=0.14.0',
'setproctitle',
'cryptography>=2.5',
],
tests_require=['tox', 'pytest-mock', 'pytest', 'mock', 'pexpect'],
],
tests_require=['pytest-mock', 'pytest', 'mock', 'pexpect', 'pylint', 'flake8', 'coveralls'],
package_data={'onionbalance.config_generator': ['data/*']},
include_package_data=True,
classifiers=[

View File

@ -4,3 +4,7 @@ pytest-mock
pexpect
coveralls>=1.1
pytest-cov>=2.4
sphinx
pylint
flake8
coverage>=5.3.1

View File

@ -0,0 +1,8 @@
#!/bin/bash
set -ex
[[ $TEST ~= functional_(.*) ]]
version="${BASH_REMATCH[1]}"
pytest --cov-report=term-missing --cov=onionbalance test/functional/$version/
pylint onionbalance
flake8 onionbalance

6
test/scripts/run-unit-tests.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -ex
pytest --cov-report=term-missing --cov=onionbalance --ignore=test/functional/
pylint onionbalance --ignore=test/functional/
flake8 onionbalance

32
tox.ini
View File

@ -1,32 +0,0 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist = style, py39, docs
[testenv]
deps = -rrequirements.txt
-rtest-requirements.txt
# Pass Chutney enviroment variables into tox virtual enviroments.
passenv = CHUTNEY_ONION_ADDRESS CHUTNEY_CLIENT_PORT TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
commands = py.test --cov-report=term-missing --cov=onionbalance {posargs}
[testenv:docs]
basepython=python3
changedir=docs
deps=sphinx
commands=
sphinx-build -W -b html -d {envtmpdir}/docs . {envtmpdir}/html
[testenv:style]
basepython=python3
deps=pylint
flake8
commands=pylint onionbalance {posargs: -E}
flake8 onionbalance
[flake8]
ignore = E501, E302, E251, E305, E261
exclude = onionbalance/hs_v3/ext/