pytest 4.0 doesn't recognize module name if listed in 'testpaths'

'fontTools' is not a folder name, but the import name of the package
where we have some doctests to be discovered and run.

even though we have --pyargs option (which makes pytest first attempt
to treat any positional arguments as module import names), with the
latest pytest 4.0.0 our tests started to fail as if the new pytest
is evaluating the default 'testpaths' (as defined in setup.cfg, used
when no arguments are supplied to pytest) _before_ the --pyargs
option, and thus it thinks that 'fontTools' is a directory name
instead of a package name...

This a workaround. It also means that if one runs `pytest` without
arguments, only the tests inside `Tests` directory are going to be
run automatically, and not also the doctests inside fontTools package.

When running the test suite using tox, all tests are run, both
those in Tests folder and the doctests in fontTools.
This commit is contained in:
Cosimo Lupo 2018-11-15 08:47:20 +00:00
parent 0ab515b39e
commit 87894641c0
2 changed files with 2 additions and 3 deletions

View File

@ -37,7 +37,6 @@ license_file = LICENSE
minversion = 3.0
testpaths =
Tests
fontTools
python_files =
*_test.py
python_classes =

View File

@ -15,8 +15,8 @@ extras =
!nolxml: lxml
commands =
# test with or without coverage, passing extra positonal args to pytest
cov: coverage run --parallel-mode -m pytest {posargs}
!cov: pytest {posargs}
cov: coverage run --parallel-mode -m pytest {posargs:Tests fontTools}
!cov: pytest {posargs:Tests fontTools}
[testenv:htmlcov]
deps =