diff --git a/.travis.yml b/.travis.yml index bc17ed65..ca50801b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,15 +22,13 @@ addons: env: global: # Set defaults to avoid repeating in most cases - - PYTHON_VERSION=3.6 + - PYTHON_VERSION=3.7 - NUMPY_VERSION=stable - ASTROPY_VERSION=stable - MAIN_CMD='python setup.py' - - CONDA_DEPENDENCIES='pytz' + - CONDA_DEPENDENCIES='pytz qt pyqt six' - PIP_DEPENDENCIES='pytest-astropy' - SETUP_CMD='test -V' - - CONDA_CHANNELS='astropy' - stages: # Do the initial tests and don't proceed if they fail @@ -40,7 +38,6 @@ stages: - name: Cron and master-only tests if: type IN (push, cron) - matrix: # Don't wait for allowed failures @@ -48,8 +45,6 @@ matrix: include: - - stage: Initial tests - env: PYTHON_VERSION=3.5 SETUP_CMD='egg_info' - stage: Initial tests env: SETUP_CMD='egg_info' @@ -57,36 +52,36 @@ matrix: - os: linux stage: Initial tests env: SETUP_CMD='build_docs -w' - CONDA_DEPENDENCIES='pytz matplotlib astroquery' - PIP_DEPENDENCIES='pytest-mpl pytest-astropy' + CONDA_DEPENDENCIES='pytz matplotlib six' + PIP_DEPENDENCIES='pytest-mpl pytest-astropy astroquery' - os: linux env: PYTHON_VERSION=3.6 + # This replaces Appveyor + - os: windows + env: CONDA_DEPENDENCIES='pytz matplotlib six' + PIP_DEPENDENCIES='pyephem pytest-mpl pytest-astropy' + - os: linux stage: Initial tests env: SETUP_CMD='test --remote-data -V' - CONDA_DEPENDENCIES='pytz matplotlib' + CONDA_DEPENDENCIES='pytz matplotlib six' PIP_DEPENDENCIES='pytest-mpl pytest-astropy' - # Try pre-release version of Numpy. This only runs if a pre-release - # is available on pypi. - - os: linux - stage: Cron and master-only tests - env: NUMPY_VERSION=prerelease - # Try developer version of Astropy - os: linux - env: PYTHON_VERSION=3.6 ASTROPY_VERSION=dev + env: ASTROPY_VERSION=dev # Do a PEP8 test with pycodestyle - os: linux - env: MAIN_CMD='pycodestyle astroplan --count --max-line-length=100' SETUP_CMD='' + stage: Initial tests + env: MAIN_CMD='flake8 astroplan --count --max-line-length=100' SETUP_CMD='' allow_failures: # Allow them to fail now until the IERSs issues are fixed - env: SETUP_CMD='test --remote-data -V' - CONDA_DEPENDENCIES='pytz matplotlib' + CONDA_DEPENDENCIES='pytz matplotlib six' PIP_DEPENDENCIES='pytest-mpl pytest-astropy' install: @@ -94,7 +89,7 @@ install: - source ci-helpers/travis/setup_conda.sh # This is needed to make matplotlib plot testing work - - if [[ $TRAVIS_OS_NAME == 'linux' ]]; then + - if [[ $SETUP_CMD == test* && $TRAVIS_OS_NAME == 'linux' ]]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; export QT_API=pyqt; diff --git a/README.rst b/README.rst index be934d55..8c02b82e 100644 --- a/README.rst +++ b/README.rst @@ -27,10 +27,6 @@ Status shields :target: https://travis-ci.org/astropy/astroplan :alt: Travis Status -.. image:: https://ci.appveyor.com/api/projects/status/pff1o3vx446pav83/branch/master?svg=true - :target: https://ci.appveyor.com/project/Astropy/astroplan/branch/master - :alt: Appveyor Status - .. image:: https://img.shields.io/coveralls/astropy/astroplan.svg :target: https://coveralls.io/r/astropy/astroplan :alt: Code Coverage diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d3f38ae0..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,40 +0,0 @@ -# AppVeyor.com is a Continuous Integration service to build and run tests under -# Windows - -environment: - - global: - PYTHON: "C:\\conda" - MINICONDA_VERSION: "latest" - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd" - PYTHON_ARCH: "64" # needs to be set for CMD_IN_ENV to succeed. If a mix - # of 32 bit and 64 bit builds are needed, move this - # to the matrix section. - CONDA_DEPENDENCIES: "pytz matplotlib" - PIP_DEPENDENCIES: "pyephem pytest-mpl pytest-astropy" - CONDA_CHANNELS: "astropy" - ASTROPY_USE_SYSTEM_PYTEST: 1 - - matrix: - - # Note that we don't support Python 2.6 in astroplan, - # so we test Python 2.7 - - - PYTHON_VERSION: "3.6" - NUMPY_VERSION: "stable" - ASTROPY_VERSION: "stable" - -platform: - -x64 - -install: - - "git clone git://github.com/astropy/ci-helpers.git" - - "powershell ci-helpers/appveyor/install-miniconda.ps1" - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - "activate test" - -# Not a .NET project, we build astroplan in the install step instead -build: false - -test_script: - - "%CMD_IN_ENV% python setup.py test" diff --git a/astroplan/conftest.py b/astroplan/conftest.py index ae1d2343..2b1c9d2f 100644 --- a/astroplan/conftest.py +++ b/astroplan/conftest.py @@ -16,7 +16,7 @@ # We do this to pick up the test header report even when using LTS astropy try: - from astropy.tests.pytest_plugins import pytest_report_header + from astropy.tests.pytest_plugins import pytest_report_header # noqa except ImportError: pass diff --git a/astroplan/observer.py b/astroplan/observer.py index 32e7ae53..7a269121 100644 --- a/astroplan/observer.py +++ b/astroplan/observer.py @@ -1,6 +1,7 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) +from six import string_types # Standard library import datetime @@ -9,7 +10,6 @@ # Third-party from astropy.coordinates import (EarthLocation, SkyCoord, AltAz, get_sun, get_moon, Angle, Longitude) -from astropy.extern.six import string_types import astropy.units as u from astropy.time import Time import numpy as np @@ -18,7 +18,7 @@ # Package from .exceptions import TargetNeverUpWarning, TargetAlwaysUpWarning from .moon import moon_illumination, moon_phase_angle -from .target import get_skycoord, SpecialObjectFlag, SunFlag, MoonFlag +from .target import get_skycoord, SunFlag, MoonFlag __all__ = ["Observer", "MAGIC_TIME"] diff --git a/astroplan/plots/tests/test_sky.py b/astroplan/plots/tests/test_sky.py index fd570c4c..1f504363 100644 --- a/astroplan/plots/tests/test_sky.py +++ b/astroplan/plots/tests/test_sky.py @@ -4,7 +4,7 @@ import pytest try: - import matplotlib + import matplotlib # noqa HAS_MATPLOTLIB = True except ImportError: HAS_MATPLOTLIB = False diff --git a/astroplan/scheduling.py b/astroplan/scheduling.py index bfd3083c..e6cae2a8 100644 --- a/astroplan/scheduling.py +++ b/astroplan/scheduling.py @@ -16,11 +16,12 @@ from astropy.table import Table from .utils import time_grid_from_range, stride_array -from .constraints import AltitudeConstraint, AirmassConstraint +from .constraints import AltitudeConstraint from .target import get_skycoord -__all__ = ['ObservingBlock', 'TransitionBlock', 'Schedule', 'Slot', 'Scheduler', - 'SequentialScheduler', 'PriorityScheduler', 'Transitioner', 'Scorer'] +__all__ = ['ObservingBlock', 'TransitionBlock', 'Schedule', 'Slot', + 'Scheduler', 'SequentialScheduler', 'PriorityScheduler', + 'Transitioner', 'Scorer'] class ObservingBlock(object): @@ -569,7 +570,7 @@ def _make_schedule(self, blocks): objects with populated ``start_time`` and ``end_time`` or ``duration`` attributes. """ raise NotImplementedError - return schedule + # return schedule @classmethod @u.quantity_input(duration=u.second) @@ -997,7 +998,6 @@ def __call__(self, oldblock, newblock, start_time, observer): from .constraints import _get_altaz from .target import get_skycoord if oldblock.target != newblock.target: - from .target import get_skycoord targets = get_skycoord([oldblock.target, newblock.target]) aaz = _get_altaz(start_time, observer, targets)['altaz'] sep = aaz[0].separation(aaz[1]) diff --git a/astroplan/target.py b/astroplan/target.py index b72cf6ee..8a05dfca 100644 --- a/astroplan/target.py +++ b/astroplan/target.py @@ -7,8 +7,7 @@ # Third-party import astropy.units as u -from astropy.coordinates import (SkyCoord, ICRS, UnitSphericalRepresentation, - SphericalRepresentation) +from astropy.coordinates import SkyCoord, ICRS, UnitSphericalRepresentation __all__ = ["Target", "FixedTarget", "NonFixedTarget"] diff --git a/astroplan/tests/test_constraints.py b/astroplan/tests/test_constraints.py index 26ad10aa..b7222ec0 100644 --- a/astroplan/tests/test_constraints.py +++ b/astroplan/tests/test_constraints.py @@ -55,8 +55,8 @@ def test_at_night_basic(): def test_observability_table(): subaru = Observer.at_site("Subaru") - time_ranges = [Time(['2001-02-03 04:05:06', '2001-02-04 04:05:06']), # 1 day - Time(['2007-08-09 10:11:12', '2007-08-09 11:11:12'])] # 1 hr + # time_ranges = [Time(['2001-02-03 04:05:06', '2001-02-04 04:05:06']), # 1 day + # Time(['2007-08-09 10:11:12', '2007-08-09 11:11:12'])] # 1 hr targets = [vega, rigel, polaris] time_range = Time(['2001-02-03 04:05:06', '2001-02-04 04:05:06']) diff --git a/astroplan/tests/test_observer.py b/astroplan/tests/test_observer.py index ff275a5a..28013a43 100644 --- a/astroplan/tests/test_observer.py +++ b/astroplan/tests/test_observer.py @@ -270,7 +270,7 @@ def test_parallactic_angle(): def print_pyephem_parallactic_angle(): - lat = 19.826218*u.deg + # lat = 19.826218*u.deg lon = -155.471999*u.deg time = Time('2015-01-01 00:00:00') LST = time.sidereal_time('mean', longitude=lon) @@ -779,7 +779,6 @@ def test_solar_transit_convenience_methods(): pressure = 0 * u.bar location = EarthLocation.from_geodetic(lon, lat, elevation) time = Time('2000-01-01 12:00:00') - from astropy.coordinates import get_sun obs = Observer(location=location, pressure=pressure) # Compute next/previous noon/midnight using generic calc_transit methods @@ -1234,7 +1233,7 @@ def test_tonight(): post_civil_sunset = Time('2016-08-08 05:00:00') during_twilight = obs.tonight(time=post_civil_sunset, horizon=horizon) - during_twilight_wo_horizon = obs.tonight(time=post_civil_sunset) + during_twilight_wo_horizon = obs.tonight(time=post_civil_sunset) # noqa # Get correct astro sunset if checking after civil sunset assert (abs(astro_sunset.datetime - during_twilight[0].datetime) < @@ -1279,7 +1278,7 @@ def test_moon_rise_set(): lat = '42:00:00' lon = '-70:00:00' elevation = 0.0 * u.m - pressure = 0 * u.bar + # pressure = 0 * u.bar location = EarthLocation.from_geodetic(lon, lat, elevation) obs = Observer(location=location) diff --git a/astroplan/tests/test_target.py b/astroplan/tests/test_target.py index 7da3ee18..208a0a12 100644 --- a/astroplan/tests/test_target.py +++ b/astroplan/tests/test_target.py @@ -58,7 +58,7 @@ def test_get_skycoord(): coo = get_skycoord(m31) assert coo.is_equivalent_frame(ICRS()) - with pytest.raises(TypeError) as exc_info: + with pytest.raises(TypeError): len(coo) coo = get_skycoord([m31]) diff --git a/astroplan/tests/test_utils.py b/astroplan/tests/test_utils.py index 1fab6587..692a69c4 100644 --- a/astroplan/tests/test_utils.py +++ b/astroplan/tests/test_utils.py @@ -53,7 +53,7 @@ def test_stride_array(): def test_stride_floats(): arr_float = np.asarray(arr10, float) - stride10by3 = stride_array(arr_float, 3) + stride_array(arr_float, 3) # stride 10 by 3 def test_time_grid_from_range(): diff --git a/setup.cfg b/setup.cfg index 4ecfd3fd..25230d50 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,9 @@ github_project = astropy/astroplan [entry_points] [flake8] -exclude = _astropy_init.py,extern +exclude = _astropy_init.py,extern,__init__.py +max-line-length = 100 [pycodestyle] -exclude = _astropy_init.py,extern \ No newline at end of file +exclude = _astropy_init.py,extern,__init__.py +max-line-length = 100 diff --git a/setup.py b/setup.py index f20e09df..b7526f99 100755 --- a/setup.py +++ b/setup.py @@ -102,7 +102,7 @@ version=VERSION, description=DESCRIPTION, scripts=scripts, - install_requires=['numpy>=1.10', 'astropy>=1.3', 'pytz'], + install_requires=['numpy>=1.10', 'astropy>=1.3', 'pytz', 'six'], extras_require=dict( plotting=['matplotlib>=1.4'], docs=['sphinx_rtd_theme'],