From 66158106c4301fd8f19f7b9f9ee4752924eb6388 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Mon, 21 Sep 2015 12:51:43 -0400 Subject: [PATCH] This now copies the docs for testing into the temp dir, and ensures that the setup.cfg is in the common root directory for the Python files and the docs. This ensures that in py.test >= 2.7 the correct common test directory can be found as the 'rootdir'. Seems to work fine with older versions of py.test as well (down to 2.4). --- CHANGES.rst | 6 +++--- astropy_helpers/commands/_test_compat.py | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 648a7e37..f027b8c9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -38,9 +38,9 @@ astropy-helpers Changelog - Quieted warnings about deprecated Numpy API in Cython extensions, when building Cython extensions against Numpy >= 1.7. [#183] -- Added a new ``temp-root`` option to the ``./setup.py test`` command, which is - needed in part to support the upgrade to py.test 2.7 (which itself is needed - to support Python 3.5). [#187] +- Improved support for py.test >= 2.7--running the ``./setup.py test`` command + now copies all doc pages into the temporary test directory as well, so that + all test files have a "common root directory". [#189] 1.0.3 (2015-07-22) diff --git a/astropy_helpers/commands/_test_compat.py b/astropy_helpers/commands/_test_compat.py index 22a8de9b..16624753 100644 --- a/astropy_helpers/commands/_test_compat.py +++ b/astropy_helpers/commands/_test_compat.py @@ -145,17 +145,18 @@ def run(self): """ Run the tests! """ - # Build a testing install of the package - self._build_temp_install() - - # Ensure all required packages are installed - self._validate_required_deps() # Ensure there is a doc path if self.docs_path is None: if os.path.exists('docs'): self.docs_path = os.path.abspath('docs') + # Build a testing install of the package + self._build_temp_install() + + # Ensure all required packages are installed + self._validate_required_deps() + # Run everything in a try: finally: so that the tmp dir gets deleted. try: # Construct this modules testing command @@ -201,7 +202,13 @@ def _build_temp_install(self): dir=self.temp_root) self.testing_path = os.path.join(self.tmp_dir, os.path.basename(new_path)) shutil.copytree(new_path, self.testing_path) - shutil.copy('setup.cfg', self.testing_path) + + new_docs_path = os.path.join(self.tmp_dir, + os.path.basename(self.docs_path)) + shutil.copytree(self.docs_path, new_docs_path) + self.docs_path = new_docs_path + + shutil.copy('setup.cfg', self.tmp_dir) def _generate_coverage_commands(self): """