Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
This now copies the docs for testing into the temp dir, and ensures t…
Browse files Browse the repository at this point in the history
…hat 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).
  • Loading branch information
embray committed Sep 28, 2015
1 parent 6376741 commit 6615810
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CHANGES.rst
Expand Up @@ -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)
Expand Down
19 changes: 13 additions & 6 deletions astropy_helpers/commands/_test_compat.py
Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 6615810

Please sign in to comment.