Skip to content

Commit

Permalink
Adding testing infrastructure, flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Feb 25, 2020
1 parent 43dc9ef commit 20393e4
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 2 deletions.
134 changes: 134 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# We set the language to c because python isn't supported on the MacOS X nodes
# on Travis. However, the language ends up being irrelevant anyway, since we
# install Python ourselves using conda.
language: c

os:
- linux

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

# The apt packages below are needed for sphinx builds. A full list of packages
# that can be included can be found here:
#
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise

addons:
apt:
packages:
- graphviz
- texlive-latex-extra
- dvipng

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.
- PYTHON_VERSION=3.7
- NUMPY_VERSION=stable
- ASTROPY_VERSION=stable
- MAIN_CMD='python setup.py'
- SETUP_CMD='test'
- EVENT_TYPE='pull_request push'


# List runtime dependencies for the package that are available as conda
# packages here.
- CONDA_DEPENDENCIES='scipy'
- CONDA_DEPENDENCIES_DOC='sphinx-astropy'

# List other runtime dependencies for the package that are available as
# pip packages here.
- PIP_DEPENDENCIES='batman-package shapely matplotlib scipy'

# Conda packages for affiliated packages are hosted in channel
# "astropy" while builds for astropy LTS with recent numpy versions
# are in astropy-ci-extras. If your package uses either of these,
# add the channels to CONDA_CHANNELS along with any other channels
# you want to use.
- CONDA_CHANNELS='astropy-ci-extras astropy'

# If there are matplotlib or other GUI tests, uncomment the following
# line to use the X virtual framebuffer.
# - SETUP_XVFB=True

# If you want to ignore certain flake8 errors, you can list them
# in FLAKE8_OPT, for example:
- FLAKE8_OPT='--ignore=E501,W504'
# - FLAKE8_OPT=''

matrix:
# Make sure that egg_info works without dependencies
- PYTHON_VERSION=3.7 SETUP_CMD='egg_info'


matrix:

# Don't wait for allowed failures
fast_finish: true

include:
- os: linux
env: SETUP_CMD='test'

# Check for sphinx doc build warnings - we do this first because it
# may run for a long time
- os: linux
env: SETUP_CMD='build_docs -w'
CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_DOC

# Try all python versions and Numpy versions. Since we can assume that
# the Numpy developers have taken care of testing Numpy with different
# versions of Python, we can vary Python and Numpy versions at the same
# time.

# Try numpy pre-release
- os: linux
env: NUMPY_VERSION=prerelease
EVENT_TYPE='pull_request push cron'

# Do a PEP8 test with flake8
- os: linux
env: MAIN_CMD='flake8 eugene --count --show-source --statistics $FLAKE8_OPT' SETUP_CMD=''

allow_failures:
# Do a PEP8 test with flake8
# (allow to fail unless your code completely compliant)
- os: linux
env: MAIN_CMD='flake8 eugene --count --show-source --statistics $FLAKE8_OPT' SETUP_CMD=''

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_DEPENDENCIES 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 --depth 1 git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda.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 $SETUP_CMD

after_success:
# If coveralls.io is set up for this package, uncomment the line below.
# The coveragerc file may be customized as needed for your package.
# - if [[ $SETUP_CMD == *coverage* ]]; then coveralls --rcfile='eugene/tests/coveragerc'; fi
2 changes: 1 addition & 1 deletion eugene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from ._astropy_init import * # noqa
# ----------------------------------------------------------------------------

from .core import *
from .core import * # noqa
2 changes: 1 addition & 1 deletion eugene/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ def compute(R0_grid, k_grid, trials, D_min, D_max, n_min, n_max, max_cases,

samples = np.vstack([R0_chain, k_chain, D_chain, n_chain,
days_elapsed_chain, gamma_shape_chain]).T
np.save(samples_path.format(R0_grid[0]), samples)
np.save(samples_path.format(R0_grid[0]), samples)

0 comments on commit 20393e4

Please sign in to comment.