diff options
author | Nadia Dencheva <nadia.astropy@gmail.com> | 2016-08-07 12:23:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-07 12:23:24 -0400 |
commit | a2e16e39b0eb8ac0251a6473c60fee0d437c3a5f (patch) | |
tree | 7b6771e9c1974852eb8a283507677651078ce32a /setup.py | |
parent | 86d1bc5a77491770d45b86e5cf18b79ded68fb9b (diff) | |
parent | 2dc0676bc00f66a87737e78484876051633b731a (diff) | |
download | stwcs_hcf-a2e16e39b0eb8ac0251a6473c60fee0d437c3a5f.tar.gz |
Merge pull request #9 from nden/refactor-and-tests
restructure and add stwcs tests
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 50 |
1 files changed, 37 insertions, 13 deletions
@@ -2,10 +2,8 @@ import os import subprocess import sys -from glob import glob -from numpy import get_include as np_include -from setuptools import setup, find_packages, Extension - +from setuptools import setup, find_packages +from setuptools.command.test import test as TestCommand if os.path.exists('relic'): sys.path.insert(1, 'relic') @@ -25,14 +23,41 @@ else: version = relic.release.get_info() -relic.release.write_template(version, 'lib/stwcs') +relic.release.write_template(version, 'stwcs') + +try: + from distutils.config import ConfigParser +except ImportError: + from configparser import ConfigParser + +conf = ConfigParser() +conf.read(['setup.cfg']) + +# Get some config values +metadata = dict(conf.items('metadata')) +PACKAGENAME = metadata.get('package_name', 'stwcs') +DESCRIPTION = metadata.get('description', '') +AUTHOR = metadata.get('author', 'STScI') +AUTHOR_EMAIL = metadata.get('author_email', 'help@stsci.edu') + +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = ['stwcs/tests'] + self.test_suite = True + + def run_tests(self): + # import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) setup( - name = 'stwcs', + name = PACKAGENAME, version = version.pep386, - author = 'Nadia Dencheva, Warren Hack', - author_email = 'help@stsci.edu', - description = 'Recomputes and records the WCS of an HST observation (includeing distortion) in the file.', + author = AUTHOR, + author_email = AUTHOR_EMAIL, + description = DESCRIPTION, url = 'https://github.com/spacetelescope/stwcs', classifiers = [ 'Intended Audience :: Science/Research', @@ -47,13 +72,12 @@ setup( 'numpy', 'stsci.tools', ], - package_dir = { - '': 'lib', - }, - packages = find_packages('lib'), + packages = find_packages(), + tests_require = ['pytest'], package_data = { 'stwcs/gui': ['*.help'], 'stwcs/gui/pars': ['*'], 'stwcs/gui/htmlhelp': ['*'], }, + cmdclass = {"test": PyTest} ) |