Skip to content

Commit

Permalink
Initial implementation of allclose fixture
Browse files Browse the repository at this point in the history
This initial implementation is a combination of prior
implementations that were used in Nengo core and Nengo Loihi.

This repository uses Nengo Bones to manage several files,
notably those involved in continuous integration.

Co-authored-by: Trevor Bekolay <[email protected].
  • Loading branch information
hunse authored and tbekolay committed Jul 30, 2019
1 parent 2a76aa4 commit 067e791
Show file tree
Hide file tree
Showing 24 changed files with 1,447 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Automatically generated by nengo-bones, do not edit this file directly

codecov:
ci:
- "!ci.appveyor.com"
notify:
require_ci_to_pass: no

coverage:
status:
project:
default:
enabled: yes
target: auto
patch:
default:
enabled: yes
target: 100%
changes: no
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*.py[co]
.DS_Store
_build
build
dist
*.egg-info
*~
*.bak
*.swp
log.txt
.ipynb_checkpoints/
.cache
.tox
.vagrant
wintest.sh
Vagrantfile
*.class
*.eggs/
.coverage
htmlcov
*.dist-info/
.vscode
.idea
.pytest_cache/

.ci/*.sh
12 changes: 12 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[general]
ignore=body-is-missing

[title-max-length]
line-length=50

[B1]
# body line length
line-length=72

[title-match-regex]
regex=^[A-Z]
97 changes: 97 additions & 0 deletions .nengobones.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
project_name: pytest-allclose
pkg_name: pytest_allclose
repo_name: nengo/pytest-allclose
description: Pytest fixture extending Numpy's allclose function

copyright_start: 2019

license_rst:
type: mit

contributing_rst: {}

contributors_rst: {}

manifest_in: {}

setup_py:
license: MIT license
python_requires: ">=3.5"
install_req:
- numpy>=1.11
- pytest
docs_req:
- nengo_sphinx_theme>=1.0
- sphinx
tests_req:
- codespell
- coverage>=4.3
- flake8
- gitlint
- pylint
entry_points:
pytest11:
- "allclose = pytest_allclose.plugin"
classifiers:
- "Development Status :: 5 - Production/Stable"
- "Framework :: Pytest"
- "License :: OSI Approved :: MIT License"
- "Programming Language :: Python :: 3 :: Only"
- "Programming Language :: Python :: 3.5"
- "Programming Language :: Python :: 3.6"
- "Programming Language :: Python :: 3.7"

setup_cfg:
pytest:
addopts: []
allclose_tolerances:
- test_tolerances_big atol=0.01 rtol=0.2
- "test_tolerances_small atol=0.001 rtol=0.005 # test comment"
- test_parametrized[True] atol=0.1 rtol=0.2 # parametrized with big tols
- test_parametrized[False] atol=0.001 rtol=0.002 # and with small tols
- test_precedence[1] atol=1 rtol=2 # correct, specific first
- test_precedence* atol=2 rtol=4 # general, should work for 2
- test_precedence[3] atol=3 rtol=6 # incorrect, specific after general
- test_multiple_tolerances atol=0.001 rtol=0.004
- test_multiple_tolerances atol=0.01 rtol=0.05
- test_multiple_tolerances atol=0.002 rtol=0.005

docs_conf_py:
nengo_logo: general-small-light.svg

travis_yml:
python: 3.6
global_vars:
NUMPY: numpy
jobs:
- script: static
- script: test-coverage
- script: test
python: 3.5
env:
NUMPY: numpy==1.11
cache: false # disable the cache for one build to make sure that works
- script: test
python: 3.7
dist: xenial # currently only xenial has python 3.7
env:
NUMPY: numpy==1.16
- script: docs

ci_scripts:
- template: static
- template: test
pip_install:
- $NUMPY
- template: test
output_name: test-coverage
coverage: true
pip_install:
- $NUMPY
- template: docs

codecov_yml: {}

pre_commit_config_yaml: {}

pyproject_toml: {}
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically generated by nengo-bones, do not edit this file directly

repos:
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
100 changes: 100 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Automatically generated by nengo-bones, do not edit this file directly

language: python
python: 3.6
notifications:
email:
on_success: change
on_failure: change
cache: pip

dist: trusty

env:
global:
- SCRIPT="test"
- TEST_ARGS=""
- COV_CORE_SOURCE=pytest_allclose # early start pytest-cov engine
- COV_CORE_CONFIG=.coveragerc
- COV_CORE_DATAFILE=.coverage.eager
- BRANCH_NAME="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
- NUMPY="numpy"

jobs:
include:
-
env:
SCRIPT="static"
-
env:
SCRIPT="test-coverage"
-
env:
NUMPY="numpy==1.11"
SCRIPT="test"
python: 3.5
cache: False
-
env:
NUMPY="numpy==1.16"
SCRIPT="test"
python: 3.7
dist: xenial
-
env:
SCRIPT="docs"
addons:
apt:
packages:
- pandoc

before_install:
# export travis_terminate for use in scripts
- export -f travis_terminate
_travis_terminate_linux
_travis_terminate_osx
_travis_terminate_unix
_travis_terminate_windows
# upgrade pip
- pip install pip --upgrade
# install/run nengo-bones
- pip install nengo-bones
- bones-generate --output-dir .ci ci-scripts
- if [[ "$TRAVIS_PYTHON_VERSION" < "3.6" ]]; then
echo "Skipping bones-check because Python $TRAVIS_PYTHON_VERSION < 3.6";
else
bones-check;
fi
# display environment info
- pip freeze

install:
- .ci/$SCRIPT.sh install
- pip freeze

after_install:
- .ci/$SCRIPT.sh after_install

before_script:
- .ci/$SCRIPT.sh before_script

script:
- .ci/$SCRIPT.sh script

before_cache:
- .ci/$SCRIPT.sh before_cache

after_success:
- .ci/$SCRIPT.sh after_success

after_failure:
- .ci/$SCRIPT.sh after_failure

before_deploy:
- .ci/$SCRIPT.sh before_deploy

after_deploy:
- .ci/$SCRIPT.sh after_deploy

after_script:
- .ci/$SCRIPT.sh after_script
26 changes: 26 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
***************
Release History
***************

.. Changelog entries should follow this format:
version (release date)
======================
**section**
- One-line description of change (link to Github issue/PR)
.. Changes should be organized in one of several sections:
- Added
- Changed
- Deprecated
- Removed
- Fixed
1.0.0 (unreleased)
==================

Initial release of ``pytest-allclose``!
Thanks to all of the contributors for making this possible!
46 changes: 46 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.. Automatically generated by nengo-bones, do not edit this file directly
*******************************
Contributing to pytest-allclose
*******************************

Issues and pull requests are always welcome!
We appreciate help from the community to make pytest-allclose better.

Filing issues
=============

If you find a bug in pytest-allclose,
or think that a certain feature is missing,
please consider
`filing an issue <https://github.com/nengo/pytest-allclose/issues>`_!
Please search the currently open issues first
to see if your bug or feature request already exists.
If so, feel free to add a comment to the issue
so that we know that multiple people are affected.

Making pull requests
====================

If you want to fix a bug or add a feature to pytest-allclose,
we welcome pull requests.
Ensure that you fill out all sections of the pull request template,
deleting the comments as you go.
We check most aspects of code style automatically.
Please refer to our
`code style guide <https://www.nengo.ai/nengo-bones/style.html>`_
for things that we check manually.

Contributor agreement
=====================

We require that all contributions be covered under
our contributor assignment agreement. Please see
`the agreement <https://www.nengo.ai/caa/>`_
for instructions on how to sign.

More details
============

For more details on how to contribute to Nengo,
please see the `developer guide <https://www.nengo.ai/contributing/>`_.
9 changes: 9 additions & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. Automatically generated by nengo-bones, do not edit this file directly
****************************
pytest-allclose contributors
****************************

See https://www.nengo.ai/people/ for a list of
the many people who have worked on pytest-allclose;
thank you for your contributions!
29 changes: 29 additions & 0 deletions LICENSE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. Automatically generated by nengo-bones, do not edit this file directly
***********************
pytest-allclose license
***********************

MIT License

Copyright (c) 2019-2019 Applied Brain Research

Permission is hereby granted, free of charge,
to any person obtaining a copy of this software
and associated documentation files (the "Software"),
to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 067e791

Please sign in to comment.