Skip to content

Commit

Permalink
Merge pull request #29 from pllim/fix-tests
Browse files Browse the repository at this point in the history
Port tests over from pandokia
  • Loading branch information
pllim committed Feb 15, 2017
2 parents a7e1a95 + 59862fc commit b2908af
Show file tree
Hide file tree
Showing 203 changed files with 4,184 additions and 26,825 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ RELIC-INFO
*.o
*.so
__pycache__
.cache

# Other generated files
pysynphot/version.py

# Test files
test/from_commissioning/*/*.fits
test/from_commissioning/*/*.okfile

# Sphinx
_build

Expand Down
51 changes: 51 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
language: python

python:
- 2.7
- 3.5
- 3.6

env:
global:
# The following versions are the 'default' for tests, unless
# overridden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- NUMPY_VERSION=stable
- ASTROPY_VERSION=stable
- PIP_DEPENDENCIES=''
- CONDA_DEPENDENCIES=''
- MAIN_CMD='pytest pysynphot'

matrix:
include:

# Also test Astropy dev with remote data
- python: 3.5
env: ASTROPY_VERSION=development MAIN_CMD='pytest --cdbs pysynphot'

install:
# We now use the ci-helpers package to set up our testing environment.
# This is done by using Miniconda and then using conda and pip to install
# dependencies. Which dependencies are installed using conda and pip is
# determined by the CONDA_DEPDENDENCIES and PIP_DEPENDENCIES variables,
# which should be space-delimited lists of package names. See the README
# in https://github.com/astropy/ci-helpers for information about the full
# list of environment variables that can be used to customize your
# environment. In some cases, ci-helpers may not offer enough flexibility
# in how to install a package, in which case you can have additional
# commands in the install: section below.

- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh

# As described above, using ci-helpers, you should be able to set up an
# environment with dependencies installed using conda and pip, but in some
# cases this may not provide enough flexibility in how to install a
# specific dependency (and it will not be able to install non-Python
# dependencies). Therefore, you can also include commands below (as
# well as at the start of the install section or in the before_install
# section if they are needed before setting up conda) to install any
# other dependencies.

script:
- $MAIN_CMD
8 changes: 0 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,3 @@ prune build
prune doc/build

global-exclude *.pyc *.o

include pysynphot/test/*.disable
include pysynphot/test/*.doctest
include pysynphot/test/auto_test
include pysynphot/test/pdk*

include pysynphot/test/from_commissioning/pdk*
include pysynphot/test/from_commissioning/*/*.disable
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
PySynphot
=========

|docs|
|travisci| |docs|

.. |docs| image:: https://readthedocs.org/projects/pysynphot/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://pysynphot.readthedocs.io/en/latest/?badge=latest

.. |travisci| .. image:: https://travis-ci.org/spacetelescope/pysynphot.svg?branch=master
:alt: Travis CI Status
:target: https://travis-ci.org/spacetelescope/pysynphot
55 changes: 27 additions & 28 deletions pysynphot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,53 @@
"""
from __future__ import absolute_import
from .version import *

# For backwards compatibility
__svn_version__ = __version_commit__
__full_svn_info__ = '-'.join([__version__,
__version_post__,
__version_commit__,]) + ' ({0})'.format(__version_date__)
__svn_revision__ = __svn_version__
__svn_full_info__ = __full_svn_info__
try:
from .version import *
except ImportError:
__svn_version__ = 'none'
__full_svn_info__ = 'none'
__svn_revision__ = __svn_version__
__svn_full_info__ = __full_svn_info__
else:
__svn_version__ = __version_commit__
__full_svn_info__ = '-'.join(
[__version__,
__version_post__,
__version_commit__,]) + ' ({0})'.format(__version_date__)
__svn_revision__ = __svn_version__
__svn_full_info__ = __full_svn_info__


#UI:
#AnalyticSpectra:
# UI:
# AnalyticSpectra:
from .spectrum import BlackBody, GaussianSource, FlatSpectrum
from .spectrum import Powerlaw as PowerLaw
#Tabular Spectra
# Tabular Spectra
from .spectrum import FileSourceSpectrum as FileSpectrum
from .spectrum import ArraySourceSpectrum as ArraySpectrum
from .catalog import Icat
#Analytic Spectral Elements
# Analytic Spectral Elements
from .spectrum import Box, UniformTransmission
#Tabular Spectral Elements
# Tabular Spectral Elements
from .spectrum import FileSpectralElement as FileBandpass
from .spectrum import ArraySpectralElement as ArrayBandpass
#Complicated spectral elements
# Complicated spectral elements
from .obsbandpass import ObsBandpass
from .reddening import Extinction
#Observations
# Observations
from .observation import Observation
#Other constructs
# Other constructs
from .observationmode import ObservationMode as Obsmode
from numpy import arange as Waveset
#Get Vega
# Get Vega
from .spectrum import Vega
#Get cache
# Get cache
from . import Cache
#Permit resetting refdata
# Permit resetting refdata
from .refs import setref, showref, getref
#
# Others
from .locations import get_data_filename
from .spparser import parse_spec
from . import tables

def _test():
"Runs doctest on the examples in this file"
import doctest
nfail,ntest=doctest.testfile('__init__.py')
return nfail,ntest

if __name__ == '__main__':
nfail,ntest=_test()

0 comments on commit b2908af

Please sign in to comment.