Skip to content

Commit

Permalink
Fix test warnings (#37)
Browse files Browse the repository at this point in the history
* fix test warnings

* cleanup

* update codecov config

* change workflow name

* fix test name

* fewer platforms

* clean up test requirements
  • Loading branch information
JoshKarpel committed Nov 19, 2020
1 parent f799f85 commit ff3fe05
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 37 deletions.
16 changes: 11 additions & 5 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
coverage:
range: 50..90
range: 90..100
round: down
precision: 0

comment:
layout: "diff, files"
precision: 1
status:
project:
default:
target: auto
informational: true
patch:
default:
target: auto
informational: true
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
pull_request:

jobs:
build:
test:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest, ubuntu-20.04, ubuntu-18.04]
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]

runs-on: ${{ matrix.platform }}
Expand Down
32 changes: 22 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,32 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v3.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: debug-statements
- id: check-merge-conflict
- id: mixed-line-ending
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.7.0
hooks:
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: python-use-type-annotations
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.9
hooks:
- id: remove-crlf
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
Expand All @@ -25,15 +36,16 @@ repos:
rev: v1.8.0
hooks:
- id: blacken-docs
additional_dependencies: [ black==20.8b1 ]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.11.0
rev: v1.15.1
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/timothycrosley/isort
rev: 5.5.2
rev: 5.6.4
hooks:
- id: isort
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinx.ext.napoleon",
"sphinx_rtd_theme",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
2 changes: 1 addition & 1 deletion idesolver/idesolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def dtype(n):
return n.dtype if isinstance(n, np.ndarray) else type(n)


# types to recognize as complex in y_0
# data types to recognize as complex in y_0
_COMPLEX_NUMERIC_TYPES = [complex, np.complex128]


Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ include = "\\.pyi?$"

[tool.isort]
known_third_party = ["hypothesis", "matplotlib", "numpy", "pytest", "scipy", "setuptools", "sphinx_rtd_theme"]
profile = "black"
line_length = 100
multi_line_output = "VERTICAL_HANGING_INDENT"
include_trailing_comma = true

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down
5 changes: 0 additions & 5 deletions pytest.ini

This file was deleted.

4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers =
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Mathematics

Expand All @@ -38,15 +39,12 @@ docs =
sphinx_autodoc_typehints
sphinx_rtd_theme
tests =
codecov
coverage
hypothesis
pre-commit
pytest>=6
pytest-cov
pytest-cov
pytest-mock
pytest-xdist

[bdist_wheel]
universal = 1
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest


@pytest.fixture(scope="function")
@pytest.fixture(scope="session")
def dummy_args():
x = np.linspace(0, 1, 100)
y_0 = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/test_complex_quad.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def x():
lambda x: 0.1 * x ** 2,
lambda x: np.exp(x),
lambda x: np.log(x),
lambda x: 1 / x,
lambda x: 1 / (x + 0.1),
],
)
def real_integrand(request):
Expand Down
8 changes: 3 additions & 5 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ def test_callback_is_called_correct_number_of_times(mocker):
assert callback.call_count == solver.iteration + 1


@pytest.fixture(scope="function")
@pytest.fixture(scope="module")
def default_solver():
solver = IDESolver(x=np.linspace(0, 1, 100), y_0=0)

return solver
return IDESolver(x=np.linspace(0, 1, 100), y_0=0)


@hyp.given(x=st.complex_numbers(), y=st.complex_numbers())
Expand All @@ -139,7 +137,7 @@ def test_default_d(default_solver, x):


@hyp.given(x=st.complex_numbers(), s=st.complex_numbers())
def test_default_c(default_solver, x, s):
def test_default_k(default_solver, x, s):
assert default_solver.k(x, s) == 1


Expand Down
2 changes: 0 additions & 2 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

import idesolver


Expand Down

0 comments on commit ff3fe05

Please sign in to comment.