Skip to content

Commit

Permalink
Don't overload deps: It's slower but ensures we use the pinned ones.
Browse files Browse the repository at this point in the history
Also use pip-sync, to avoid having to use `tox -r` when we change or
upgrade our requirements, see:
tox-dev/tox#149

Which is good for CI stability: if black passes today, it'll pass tomorrow.
  • Loading branch information
JulienPalard committed Jan 18, 2021
1 parent b976433 commit d63829a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
path: |
.venv
.tox
key: ${{ matrix.os }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('requirements-dev.txt') }}-${{ matrix.tox.python-version }}
key: ${{ matrix.os }}-${{ hashFiles('tox.ini') }}-${{ matrix.tox.python-version }}
- name: setup tox
run: |
python --version
Expand Down
10 changes: 6 additions & 4 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
black
coverage
flake8
flake8-bugbear
hypothesis
isort
matplotlib
mypy
pip-tools
pydocstyle
pylint
pytest
coverage
tox
sympy
pylint
isort
tox
11 changes: 10 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ astroid==2.4.2
# via pylint
attrs==20.3.0
# via
# flake8-bugbear
# hypothesis
# pytest
black==20.8b1
Expand All @@ -30,8 +31,12 @@ filelock==3.0.12
# via
# tox
# virtualenv
flake8==3.8.4
flake8-bugbear==20.11.1
# via -r requirements-dev.in
flake8==3.8.4
# via
# -r requirements-dev.in
# flake8-bugbear
hypothesis==5.41.4
# via -r requirements-dev.in
iniconfig==1.1.1
Expand Down Expand Up @@ -80,6 +85,8 @@ py==1.9.0
# tox
pycodestyle==2.6.0
# via flake8
pydocstyle==5.1.1
# via -r requirements-dev.in
pyflakes==2.2.0
# via flake8
pylint==2.6.0
Expand All @@ -103,6 +110,8 @@ six==1.15.0
# python-dateutil
# tox
# virtualenv
snowballstemmer==2.0.0
# via pydocstyle
sortedcontainers==2.3.0
# via hypothesis
sympy==1.7
Expand Down
9 changes: 3 additions & 6 deletions tests/test_A004086.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import random

from oeis import A004086
from hypothesis import given
from hypothesis.strategies import integers
Expand All @@ -10,7 +8,6 @@ def test_sequence(n):
assert A004086[A004086[n]] == int(str(n).rstrip("0"))


def test_sequence_other_values():
for i in range(100):
result = random.choices("123456789", k=5)
assert A004086[int("".join(result))] == int("".join(reversed(result)))
@given(integers(min_value=100000000, max_value=999999999))
def test_sequence_other_values(n):
assert A004086[n] == int("".join(reversed(str(n))))
2 changes: 1 addition & 1 deletion tests/test_oeis.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_iteration():


def test_get_by_name():
oeis["A001220"][1] == A001220[1]
assert oeis["A001220"][1] == A001220[1]


def test_out_of_offset():
Expand Down
9 changes: 2 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ isolated_build = True
skip_missing_interpreters = True

[testenv]
deps = -r requirements-dev.txt
deps = pip-tools
commands_pre = pip-sync requirements-dev.txt
commands = coverage run -m pytest
setenv =
COVERAGE_FILE={toxworkdir}/.coverage.{envname}

[testenv:coverage]
depends = py36, py37, py38, py39
parallel_show_output = True
deps = coverage
skip_install = True
setenv = COVERAGE_FILE={toxworkdir}/.coverage
commands =
Expand All @@ -46,25 +46,20 @@ commands =


[testenv:flake8]
deps = flake8
skip_install = True
commands = flake8 tests/ oeis.py

[testenv:black]
deps = black
skip_install = True
commands = black --check --diff tests/ oeis.py

[testenv:mypy]
deps = mypy
skip_install = True
commands = mypy --ignore-missing-imports oeis.py

[testenv:pylint]
deps = pylint
commands = pylint --disable import-outside-toplevel,invalid-name oeis.py

[testenv:pydocstyle]
deps = pydocstyle
skip_install = True
commands = pydocstyle oeis.py

0 comments on commit d63829a

Please sign in to comment.