Commit 8a78210e authored by Colin Watson's avatar Colin Watson

Only require pytest-runner if running under pytest

In some environments, `setup_requires=['pytest-runner']` can result in
pytest-runner being installed as a result of installing flake8 even
though it wouldn't otherwise be required.  The pytest-runner
documentation recommends a conditional `setup_requires` to avoid this,
so use that:

  https://pypi.org/project/pytest-runner/#conditional-requirement
parent 93ad9617
Pipeline #38982144 passed with stages
in 3 minutes and 12 seconds
......@@ -12,6 +12,9 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) # noqa
import flake8
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
tests_require = ['mock >= 2.0.0', 'pytest']
# NOTE(sigmavirus24): When updating these requirements, update them in
......@@ -148,5 +151,5 @@ setuptools.setup(
"Topic :: Software Development :: Quality Assurance",
],
tests_require=tests_require,
setup_requires=['pytest-runner'],
setup_requires=pytest_runner,
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment