From 87894641c015d32b83a76b43dea07a26588e1a7e Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 15 Nov 2018 08:47:20 +0000 Subject: [PATCH] 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. --- setup.cfg | 1 - tox.ini | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index b572def35..52deab734 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,7 +37,6 @@ license_file = LICENSE minversion = 3.0 testpaths = Tests - fontTools python_files = *_test.py python_classes = diff --git a/tox.ini b/tox.ini index adf6009a5..2e8d9ee0f 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =