Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
afa2cf0
First steps towards making native pytest work
drdavella Aug 10, 2017
08df712
Start integrating the doctestsplus plugin. Bugs to fix.
drdavella Aug 10, 2017
f6a3068
Fix bugs, allow doctestplus, doctestrst to run cleanly
drdavella Aug 10, 2017
cad25a2
Add config/unicode plugins as another entry point
drdavella Aug 10, 2017
c4f52a5
Move plugins into new subdirectory
drdavella Aug 10, 2017
bafcc83
Split unicode handling logic into separate plugin
drdavella Aug 10, 2017
91e0690
Remove unused modules from config plugin
drdavella Aug 10, 2017
35f53b0
Separate display and configuration logic into separate plugins
drdavella Aug 11, 2017
dead42e
Update documentation headers for pytest plugins
drdavella Aug 11, 2017
1ea3191
Fix astropy test runner arguments
drdavella Aug 11, 2017
68c7542
Updates to norecursedirs in top-level config
drdavella Aug 11, 2017
7862c53
Automatically install development version of package
drdavella Aug 11, 2017
97180a1
Make flake8 happy -- fix trailing whitespace
drdavella Aug 11, 2017
6d42858
Remove remote data plugin from astropy core
drdavella Sep 21, 2017
5ae6ad5
Remove open file detection plugin from astropy core
drdavella Sep 21, 2017
be6f09b
Remove doctest plus plugin from astropy core
drdavella Sep 21, 2017
d26cc4f
Remove unicode plugin: not needed for Py3
drdavella Sep 25, 2017
b17271e
IERS configuration should not rely on INTERNET_OFF
drdavella Sep 25, 2017
f6253e6
Time tests can no longer use INTERNET_OFF. Use @remote_data instead
drdavella Sep 25, 2017
dc3f5da
Remove disable_internet functionality from core...
drdavella Sep 25, 2017
1a27565
Reuse min_numpy_version in multiple places
drdavella Sep 26, 2017
8b89f60
Update setup.py now that dependencies are published
drdavella Oct 10, 2017
19aed18
Add pytest-astropy to pip dependencies for CI tests
drdavella Oct 10, 2017
9fe3bd1
Update change log
drdavella Aug 11, 2017
316be87
Fix broken combination of pytest.raises and simplefilter in wcs test
drdavella Oct 13, 2017
516cbed
Use extras_require for pytest-astropy, not setup_requires...
drdavella Oct 18, 2017
a466ac9
Test runner now checks for available test dependencies
drdavella Oct 18, 2017
19ee6dc
Use top-level conftest for plugins instead of setup.py
drdavella Oct 10, 2017
07860a6
Disable coverage for code that doesn't run on CI server
drdavella Oct 19, 2017
f3e356e
Remove 'repeat' plugin: use pytest-repeat instead
drdavella Oct 22, 2017
cee0344
Convert one travis test to use native pytest...
drdavella Oct 23, 2017
c16c2fa
Add astropy.tests.pytest_plugins for backwards compatibility...
drdavella Nov 3, 2017
1919592
Import disable_internet into `astropy.tests` for backwards compatibility
drdavella Nov 3, 2017
93a78fb
Add comment about backwards compatibility
drdavella Nov 6, 2017
5912e3f
Add pytest-astropy to pip-requirements-dev
drdavella Nov 6, 2017
00e77db
Address feedback from code review
drdavella Nov 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .run_docker_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ python3 -c 'import sys; print(sys.maxsize)'

# The doctestplus plugin in Astropy doesn't work correctly with pytest>=3.2, so
# we install an older version here
easy_install-3.5 pytest pytest-xdist
easy_install-3.5 pytest pytest-astropy pytest-xdist

# Install git
apt-get install -y git
Expand Down
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
- MAIN_CMD='python setup.py'
- CONDA_DEPENDENCIES='Cython jinja2'
- CONDA_ALL_DEPENDENCIES='Cython jinja2 scipy h5py matplotlib pyyaml scikit-image pandas pytz beautifulsoup4 ipython mpmath bleach'
- PIP_DEPENDENCIES=''
- PIP_DEPENDENCIES='pytest-astropy'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add the pytest-astropy dependency directly to setup.py?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already there but for some reason it didn't work without being explicit here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astropy is not installed before running the tests, hence why install_requires is not used I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's true, although the error is actually a segfault that occurs while building cython extensions. This seems pretty weird to me, but I can reproduce it locally, and will try to take a closer look tomorrow.

- SETUP_XVFB=True
- EVENT_TYPE='push pull_request'
- SETUP_CMD='test'
Expand Down Expand Up @@ -77,15 +77,15 @@ matrix:
stage: Cron tests
env: SETUP_CMD='test --remote-data=astropy'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES='jplephem' EVENT_TYPE='cron'
PIP_DEPENDENCIES='pytest-astropy jplephem' EVENT_TYPE='cron'

# Check for sphinx doc build warnings - we do this first because it
# runs for a long time. The sphinx build also has some additional
# dependencies. Using a more stringent locale than UTF-8.
- os: linux
env: SETUP_CMD='build_docs -w'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES='sphinx-gallery>=0.1.12 pillow --no-deps jplephem'
PIP_DEPENDENCIES='pytest-astropy sphinx-gallery>=0.1.12 pillow --no-deps jplephem'
LC_CTYPE=C LC_ALL=C LANG=C

# Try all python versions and Numpy versions. Since we can assume that
Expand All @@ -94,16 +94,21 @@ matrix:
# time. Since we test the latest Numpy as part of the builds with all
# optional dependencies below, we can focus on older builds here.
# Numpy 1.11 is tested below in the image tests, 1.12 in the Initial stage test.
# Run this test using native pytest
- os: linux
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.10
SETUP_CMD='test --open-files'
INSTALL_CMD='python setup.py build_ext --inplace'
TEST_CMD='pytest --open-files --doctest-rst'
script:
- $INSTALL_CMD
- $TEST_CMD

# Now try with all optional dependencies.
# We also test the two latest matplotlib versions for the image tests.
- os: linux
env: PYTHON_VERSION=3.5 SETUP_CMD='test --remote-data=astropy -a "--mpl"'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES='jplephem pytest-mpl'
PIP_DEPENDENCIES='pytest-astropy jplephem pytest-mpl'
LC_CTYPE=C.ascii LC_ALL=C
NUMPY_VERSION=1.11
MATPLOTLIB_VERSION=1.5
Expand All @@ -121,7 +126,7 @@ matrix:
- os: linux
env: SETUP_CMD='test --coverage --remote-data=astropy -a "--mpl"'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES='cpp-coveralls objgraph jplephem pytest-mpl bintrees'
PIP_DEPENDENCIES='pytest-astropy cpp-coveralls objgraph jplephem pytest-mpl bintrees'
LC_CTYPE=C.ascii LC_ALL=C
CFLAGS='-ftest-coverage -fprofile-arcs -fno-inline-functions -O0'
MATPLOTLIB_VERSION=2.0
Expand Down Expand Up @@ -164,7 +169,6 @@ install:
- source ci-helpers/travis/setup_conda.sh

script:
- echo "$MAIN_CMD $SETUP_CMD"
- $MAIN_CMD $SETUP_CMD

after_success:
Expand Down
7 changes: 6 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ astropy.table
astropy.tests
^^^^^^^^^^^^^

- Split pytest plugins into separate modules. [#6384]
- Split pytest plugins into separate modules. Move remotedata, openfiles,
doctestplus plugins to standalone repositories. [#6606]

astropy.time
^^^^^^^^^^^^
Expand Down Expand Up @@ -529,6 +530,10 @@ astropy.tests

- Updated top-level config file to properly ignore top-level directories.
[#6449]
- Fixed issue with running test suite directly from ``pytest``. [#6437]

astropy.time

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do a thorough review later. At a glance, the inclusion of extra astropy.time section seems unrelated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, that was definitely an oversight. It might have happened when I rebased the old PR on the latest master (using git-rerere!!!).

@pllim pllim Sep 25, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off topic: Someone needs to implement git-argharghargh to undo rerere.

^^^^^^^^^^^^

astropy.units
^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:
# of 32 bit and 64 bit builds are needed, move this
# to the matrix section.
CONDA_DEPENDENCIES: "Cython scipy h5py beautifulsoup4 jinja2 pyyaml matplotlib scikit-image pytz"
PIP_DEPENDENCIES: "objgraph"
PIP_DEPENDENCIES: "pytest-astropy objgraph"

matrix:
- PYTHON_VERSION: "3.6"
Expand Down
17 changes: 11 additions & 6 deletions astropy/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# this contains imports plugins that configure py.test for astropy tests.
# by importing them here in conftest.py they are discoverable by py.test
# no matter how it is invoked within the astropy tree.
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains pytest configuration settings that are astropy-specific
(i.e. those that would not necessarily be shared by affiliated packages
making use of astropy's test runner).
"""
from astropy.tests.plugins.display import PYTEST_HEADER_MODULES
from astropy.tests.helper import enable_deprecations_as_exceptions

from .tests.pytest_plugins import *

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great to see gone, probably we should also do it in the package-template to make it less black boxy

enable_deprecations_as_exceptions(include_astropy_deprecations=False)

try:
import matplotlib
Expand All @@ -11,6 +16,6 @@
else:
matplotlib.use('Agg')

enable_deprecations_as_exceptions(include_astropy_deprecations=False)

# This is astropy-specific so should not be included in a generic plugin that
# could potentially be used by other projects
PYTEST_HEADER_MODULES['Cython'] = 'cython'
21 changes: 21 additions & 0 deletions astropy/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,24 @@
for writing tests, and general tests that are not associated with a
particular package.
"""

# NOTE: This is retained only for backwards compatibility. Affiliated packages
# should no longer import ``disable_internet`` from ``astropy.tests``. It is
# now available from ``pytest_remotedata``. However, this is not the
# recommended mechanism for controlling access to remote data in tests.
# Instead, packages should make use of decorators provided by the
# pytest_remotedata plugin: - ``@pytest.mark.remote_data`` for tests that
# require remote data access - ``@pytest.mark.internet_off`` for tests that
# should only run when remote data access is disabled. Remote data access for
# the test suite is controlled by the ``--remote-data`` command line flag. This
# is either passed to ``pytest`` directly or to the ``setup.py test`` command.
#
# TODO: This import should eventually be removed once backwards compatibility
# is no longer supported.

try:
# This should only be necessary during testing, in which case the test
# package must be installed anyway.
from pytest_remotedata import disable_internet
except ImportError:
pass
150 changes: 0 additions & 150 deletions astropy/tests/disable_internet.py

This file was deleted.

1 change: 1 addition & 0 deletions astropy/tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'pickle_protocol', 'generic_recursive_equality_test']

# pytest marker to mark tests which get data from the web
# This is being maintained for backwards compatibility
remote_data = pytest.mark.remote_data


Expand Down
Loading