Skip to content

Commit

Permalink
Merge pull request #19 from joaomcteixeira/toximprove2
Browse files Browse the repository at this point in the history
Improve Tox configuration
  • Loading branch information
joaomcteixeira authored Jan 19, 2020
2 parents c5b9bd1 + 944f524 commit 7e6df7d
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ matrix:
env:
- TOXENV=docs
- env:
- TOXENV=clean,py36,codecov,coveralls,report
- TOXENV=py36,codecov,coveralls
python: '3.6'
- env:
- TOXENV=clean,py37,codecov,coveralls,report
- TOXENV=py37,codecov,coveralls
python: '3.7'

before_install:
Expand Down
5 changes: 4 additions & 1 deletion tests/test_libcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def myfunc(cov, *args, **kwargs):
parser.add_argument('--cov', nargs=argparse.REMAINDER)
result = lc.maincli(parser, myfunc)
# since we have it, lets play it with and close the circle
assert result == '--cov-report=term-missing -vv tests'.split()
assert result == (
'--cov-report=term-missing '
'--cov-append --cov-config=.coveragerc -vv tests'
).split()


def test_save_refs():
Expand Down
28 changes: 28 additions & 0 deletions tests/test_libplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Test libplot."""

from taurenmd import Path
from taurenmd.libs import libplot as lplt


def test_param():
"""Test param plot."""
p = Path('param.pdf')
lplt.param(
list(range(10)),
list(range(10)),
filename='param.pdf',
)
assert p.exists()
p.unlink()


def test_label_dots():
"""Test label_dots plot."""
p = Path('label_dots.pdf')
lplt.param(
['a', 'b', 'c'],
list(range(3)),
filename='label_dots.pdf',
)
assert p.exists()
p.unlink()
95 changes: 64 additions & 31 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
[tox]
minversion = 3.14.0
envlist =
clean,
check,
radon,
docs,
{py36,py37},
report
clean
check
radon
docs
py36
py37
#report
ignore_basepython_conflict = true

[testenv]
basepython =
{py36}: {env:TOXPYTHON:python3.6}
{py37,docs}: {env:TOXPYTHON:python3.7}
{clean,check,radon,report,codecov,coveralls}: {env:TOXPYTHON:python3}
{check,radon,codecov,coveralls}: {env:TOXPYTHON:python3}
passenv = *

[testenv:py36]
setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
passenv =
*
usedevelop = false
#COV_CORE_SOURCE=
#COV_CORE_CONFIG={toxinidir}/.coveragerc
#COV_CORE_DATAFILE={toxinidir}/.coverage
user_develop = false
deps =
pytest
pytest-travis-fold
pytest-cov
coverage
bioplottemplates
pyquaternion
conda_deps =
Expand All @@ -34,8 +41,23 @@ conda_channels =
conda-forge
omnia
defaults
commands_pre =
coverage erase
commands =
{posargs:pytest --cov --cov-report=term-missing -vv tests}
{posargs:pytest --cov --cov-report=term-missing --cov-append --cov-config=.coveragerc -vv tests}
commands_post =
coverage report
coverage html

[testenv:py37]
setenv = {[testenv:py36]setenv}
user_develop = {[testenv:py36]user_develop}
deps = {[testenv:py36]deps}
conda_deps = {[testenv:py36]conda_deps}
conda_channels = {[testenv:py36]conda_channels}
commands_pre = {[testenv:py36]commands_pre}
commands = {[testenv:py36]commands}
commands_post = {[testenv:py36]commands_post}

[testenv:check]
deps =
Expand All @@ -48,6 +70,7 @@ deps =
pygments
isort
bumpversion
#usedevelop = false
skip_install = true
commands =
python setup.py check --strict --metadata --restructuredtext
Expand All @@ -67,37 +90,40 @@ commands =

[testenv:docs]
usedevelop = true
#skip_install = true
deps =
-r{toxinidir}/docs/requirements.txt
commands =
sphinx-build {posargs:-E} -b html docs dist/docs
#sphinx-build -b linkcheck docs dist/docs

[testenv:codecov]
depends = report
deps =
codecov
skip_install = true
commands =
codecov []

[testenv:coveralls]
depends = report
deps =
coveralls
skip_install = true
commands =
coveralls []

[testenv:report]
deps = coverage
skip_install = true
commands =
coverage report
coverage html
#[testenv:report]
#deps = coverage
#skip_install = true
#commands =
# coverage report
# coverage html

[testenv:clean]
commands = coverage erase
skip_install = true
deps = coverage
#[testenv:clean]
#skip_install = true
#deps = coverage
#commands = coverage erase


# my favourite configuration for flake8 styling
Expand Down Expand Up @@ -127,26 +153,33 @@ sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
#known_future_library=future,pies
#known_standard_library=std,std2
known_first_party = taurenmd
known_third_party = pytest,bioplottemplates,pyquaternion
known_third_party =
bioplottemplates
MDAnalysis
mdtraj
numpy
simtk
pyquaternion
pytest

[tool:pytest]
# If a pytest section is found in one of the possible config files
# (pytest.ini, tox.ini or setup.cfg), then pytest will not look for any others,
# so if you add a pytest config section elsewhere,
# you will need to delete this section from setup.cfg.
norecursedirs =
migrations

#norecursedirs =
#migrations
addopts = -p pytest_cov
python_files =
test_*.py
*_test.py
tests.py
addopts =
-ra
--strict
--doctest-modules
--doctest-glob=\*.rst
--tb=short
#addopts =
# -ra
# --strict
# --doctest-modules
# --doctest-glob=\*.rst
# --tb=short
testpaths =
tests

0 comments on commit 7e6df7d

Please sign in to comment.