diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-09-18 09:20:17 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-09-18 09:20:17 -0400 |
commit | 2f3b7b204187a1c93c391ffac96a9220cbb57f91 (patch) | |
tree | b7ab7ad5cfa54008adc9dac25163e15f7872f5e9 | |
parent | 469be24cdfec5fd1bc7aed4522910a19c1126e30 (diff) | |
download | external_python_setuptools-2f3b7b204187a1c93c391ffac96a9220cbb57f91.tar.gz external_python_setuptools-2f3b7b204187a1c93c391ffac96a9220cbb57f91.tar.bz2 external_python_setuptools-2f3b7b204187a1c93c391ffac96a9220cbb57f91.zip |
Extract test.install_dists and distill it with a variable extraction and fallback variables.
-rw-r--r-- | CHANGES.rst | 3 | ||||
-rw-r--r-- | setuptools/command/test.py | 23 |
2 files changed, 14 insertions, 12 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 54a4d52a..8af3b938 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,7 +7,8 @@ v27.3.0 * #794: In test command, add installed eggs to PYTHONPATH when invoking tests so that subprocesses will also have the - dependencies available. + dependencies available. Fixes `tox 330 + <https://github.com/tox-dev/tox/issues/330>`_. v27.2.0 ------- diff --git a/setuptools/command/test.py b/setuptools/command/test.py index e0650d27..48d5b5e1 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -2,6 +2,7 @@ import os import operator import sys import contextlib +import itertools from distutils.errors import DistutilsOptionError from unittest import TestLoader @@ -185,18 +186,18 @@ class test(Command): else: os.environ['PYTHONPATH'] = orig_pythonpath + def install_dists(self): + """ + Install the requirements indicated by self.distribution and + return an iterable of the dists that were built. + """ + dist = self.distribution + ir_d = dist.fetch_build_eggs(dist.install_requires or []) + tr_d = dist.fetch_build_eggs(dist.tests_require or []) + return itertools.chain(ir_d, tr_d) + def run(self): - installed_dists = [] - if self.distribution.install_requires: - installed_dists.extend( - self.distribution.fetch_build_eggs( - self.distribution.install_requires, - )) - if self.distribution.tests_require: - installed_dists.extend( - self.distribution.fetch_build_eggs( - self.distribution.tests_require, - )) + installed_dists = self.install_dists() cmd = ' '.join(self._argv) if self.dry_run: |