diff --git a/.gitignore b/.gitignore index 4d065f5..fca8de1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,95 +1,63 @@ -# Created by .ignore support plugin (hsz.mobi) -### Python template -# Byte-compiled / optimized / DLL files -__pycache__/ +# Compiled files *.py[cod] -*$py.class - -# C extensions +*.a +*.o *.so +*.pyd +__pycache__ -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py +# Ignore .c files by default to avoid including generated code. If you want to +# add a non-generated .c extension, use `git add -f filename.c`. +*.c -# Flask stuff: -instance/ -.webassets-cache +# Other generated files +MANIFEST -# Scrapy stuff: -.scrapy +# Sphinx +_build +_generated +docs/api +docs/generated -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version +# Packages/installer info +*.egg +*.egg-info +dist +build +eggs +.eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +distribute-*.tar.gz -# celery beat schedule file -celerybeat-schedule +# Other +.cache +.tox +.*.swp +.*.swo +*~ +.project +.pydevproject +.settings +.coverage +cover +htmlcov +.pytest_cache -# dotenv +# Env +.venv +venv .env -# virtualenv -.venv/ -venv/ -ENV/ - -# Spyder project settings -.spyderproject +# Mac OSX +.DS_Store -# Rope project settings -.ropeproject - -# PyCharm project settings +# PyCharm .idea + +*/version.py +pip-wheel-metadata/ diff --git a/.travis.yml b/.travis.yml index fbe4768..4dcf0f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,12 @@ +# 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 + +# Use Travis' container-based architecture sudo: false notifications: @@ -10,29 +17,58 @@ notifications: if: type = cron env: - global: - - CONDA_DEPENDENCIES="pytest pytest-cov numpy astropy" - - PIP_DEPENDENCIES="codecov" - matrix: - - PYTHON_VERSION=2.7 - - PYTHON_VERSION=3.5 - - PYTHON_VERSION=3.6 + global: + # The following versions are the 'default' for tests, unless + # overidden underneath. They are defined here in order to save having + # to repeat them for all configurations. + - TOXENV='test' + - TOXARGS='-v' + - TOXPOSARGS='' -install: - - git clone git://github.com/astropy/ci-helpers.git - - source ci-helpers/travis/setup_conda.sh +matrix: + include: - # Make sure pytest-arraydiff wasn't installed by conda - - conda remove pytest-arraydiff --force || true + - language: python + python: 3.6 + name: Python 3.6 and pytest 4.6 (Linux) + env: TOXENV=py36-test-pytest46 - # Need to use develop instead of install to make sure coverage works - - pip install -e . + - os: windows + name: Python 3.6 and pytest 5.0 (Windows) + env: PYTHON_VERSION=3.6 + TOXENV=py36-test-pytest50 -script: - - python -c 'import pytest_arraydiff.plugin' - - pytest -vv --arraydiff --cov pytest_arraydiff tests - - pytest -vv --cov pytest_arraydiff --cov-append tests - - python setup.py check --restructuredtext + - os: osx + name: Python 3.7 and pytest 5.1 (MacOS X) + env: PYTHON_VERSION=3.7 + TOXENV=py37-test-pytest51 + + - language: python + python: 3.7 + name: Python 3.7 and pytest 5.2 (Linux) + env: TOXENV=py37-test-pytest52 + + - os: windows + name: Python 3.8 and pytest 5.3 (Windows) + env: PYTHON_VERSION=3.8 + TOXENV=py38-test-pytest53 -after_success: - - codecov + - language: python + python: 3.8 + name: Python 3.8 and pytest 6.0 (Linux) + env: TOXENV=py38-test-pytest60 + + - os: osx + name: Python 3.8 and pytest dev (MacOS X) + env: PYTHON_VERSION=3.8 + TOXENV=py38-test-pytestdev + +install: + - if [[ $TRAVIS_OS_NAME == osx || $TRAVIS_OS_NAME == windows ]]; then + git clone git://github.com/astropy/ci-helpers.git; + source ci-helpers/travis/setup_python.sh; + fi + +script: + - pip install tox + - tox $TOXARGS -- $TOXPOSARGS diff --git a/MANIFEST.in b/MANIFEST.in index 73a6b90..d56a613 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,8 @@ include LICENSE include README.rst include CHANGES.md include tox.ini +include pyproject.toml +include setup.cfg +include setup.py recursive-include tests *.py *.fits *.txt diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 4b91f37..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -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: "pytest numpy astropy" - PIP_DEPENDENCIES: "codecov" - - matrix: - - PYTHON_VERSION: "2.7" - - PYTHON_VERSION: "3.5" - - PYTHON_VERSION: "3.6" - -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" - - "%CMD_IN_ENV% python setup.py install" - -build: false - -test_script: - - "%CMD_IN_ENV% py.test tests --arraydiff" - - "%CMD_IN_ENV% codecov" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..590e0b1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = ["setuptools>=30.3.0", + "setuptools_scm", + "wheel"] +build-backend = 'setuptools.build_meta' diff --git a/pytest_arraydiff/__init__.py b/pytest_arraydiff/__init__.py index 9e1448e..b507b35 100755 --- a/pytest_arraydiff/__init__.py +++ b/pytest_arraydiff/__init__.py @@ -1 +1,3 @@ -__version__ = '0.4.dev0' +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +from .version import version as __version__ # noqa diff --git a/pytest_arraydiff/plugin.py b/pytest_arraydiff/plugin.py index cd63b69..c13c651 100755 --- a/pytest_arraydiff/plugin.py +++ b/pytest_arraydiff/plugin.py @@ -36,7 +36,6 @@ import shutil import tempfile import warnings -from distutils.version import StrictVersion import six from six.moves.urllib.request import urlopen @@ -213,10 +212,7 @@ def __init__(self, config, reference_dir=None, generate_dir=None, default_format def pytest_runtest_setup(self, item): - if StrictVersion(pytest.__version__) < StrictVersion("3.6"): - compare = item.get_marker('array_compare') - else: - compare = item.get_closest_marker('array_compare') + compare = item.get_closest_marker('array_compare') if compare is None: return diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0476309 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,48 @@ +[metadata] +name = pytest-arraydiff +url = https://github.com/astrofrog/pytest-arraydiff +author = The Astropy Developers +author_email = astropy.team@gmail.com +classifiers = + Development Status :: 4 - Beta + Framework :: Pytest + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: Implementation :: CPython + Topic :: Software Development :: Testing + Topic :: Utilities +license = BSD +description = pytest plugin to help with comparing array output from tests +long_description = file: README.rst + +[options] +zip_safe = False +packages = find: +python_requires = >=3.6 +setup_requires = + setuptools_scm +install_requires = + pytest>=4.6 + numpy + astropy + +[options.entry_points] +pytest11 = + pytest_arraydiff = pytest_arraydiff.plugin + +[tool:pytest] +minversion = 4.6 +testpaths = tests +xfail_strict = true +markers = + array_compare : for functions using array comparison + +[flake8] +max-line-length = 100 diff --git a/setup.py b/setup.py index ee5d136..3d752e0 100755 --- a/setup.py +++ b/setup.py @@ -1,37 +1,6 @@ -from setuptools import setup - -from pytest_arraydiff import __version__ +#!/usr/bin/env python -# IMPORTANT: we deliberately use rst here instead of markdown because long_description -# needs to be in rst, and requiring pandoc to be installed to convert markdown to rst -# on-the-fly is over-complicated and sometimes the generated rst has warnings that -# cause PyPI to not display it correctly. - -with open('README.rst') as infile: - long_description = infile.read() +import os +from setuptools import setup -setup( - version=__version__, - url="https://github.com/astrofrog/pytest-arraydiff", - name="pytest-arraydiff", - description='pytest plugin to help with comparing array output from tests', - long_description=long_description, - packages=['pytest_arraydiff'], - install_requires=['numpy', 'six', 'pytest'], - license='BSD', - author='Thomas Robitaille', - author_email='thomas.robitaille@gmail.com', - entry_points={'pytest11': ['pytest_arraydiff = pytest_arraydiff.plugin']}, - zip_safe=False, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Framework :: Pytest', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Testing', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 3', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: BSD License', - ], -) +setup(use_scm_version={'write_to': os.path.join('pytest_arraydiff', 'version.py')}) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..113a635 --- /dev/null +++ b/tox.ini @@ -0,0 +1,31 @@ +[tox] +envlist = + py{36,37,38}-test{,-devdeps} + codestyle +requires = + setuptools >= 30.3.0 + pip >= 19.3.1 +isolated_build = true + +[testenv] +changedir = .tmp/{envname} +description = run tests +deps = + pytest46: pytest==4.6.* + pytest50: pytest==5.0.* + pytest51: pytest==5.1.* + pytest52: pytest==5.2.* + pytest53: pytest==5.3.* + pytest60: pytest==6.0.* + pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest + +commands = + pip freeze + pytest {toxinidir}/tests {posargs} + pytest {toxinidir}/tests --arraydiff {posargs} + +[testenv:codestyle] +skip_install = true +description = check code style, e.g. with flake8 +deps = flake8 +commands = flake8 pytest_arraydiff --count