Skip to content

Commit 237b97c

Browse files
nejchJohnVillalovos
authored andcommitted
chore: clean up tox, pre-commit and requirements
1 parent b3d1c26 commit 237b97c

11 files changed

+46
-51
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,4 @@ jobs:
4040
- name: Check twine readme rendering
4141
env:
4242
TOXENV: twine-check
43-
run: |
44-
python3 setup.py sdist bdist_wheel
45-
tox
43+
run: tox

.pre-commit-config.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ repos:
66
rev: 20.8b1
77
hooks:
88
- id: black
9-
109
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
1110
rev: v5.0.0
1211
hooks:
1312
- id: commitlint
1413
additional_dependencies: ['@commitlint/config-conventional']
1514
stages: [commit-msg]
16-
17-
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
18-
rev: v5.0.0
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.8.0
1917
hooks:
20-
- id: commitlint-travis
21-
additional_dependencies: ['@commitlint/config-conventional']
22-
stages: [manual]
18+
- id: isort

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ formats:
1010
python:
1111
version: 3.8
1212
install:
13-
- requirements: rtd-requirements.txt
13+
- requirements: requirements-docs.txt

MANIFEST.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
include COPYING AUTHORS ChangeLog.rst RELEASE_NOTES.rst requirements.txt test-requirements.txt rtd-requirements.txt
2-
include tox.ini .travis.yml
1+
include COPYING AUTHORS ChangeLog.rst RELEASE_NOTES.rst requirements*.txt
2+
include tox.ini
33
recursive-include tests *
44
recursive-include docs *j2 *.py *.rst api/*.rst Makefile make.bat
5-
recursive-include tests/unit/data *

README.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,22 @@ To format your code according to our guidelines before committing, run:
144144
Running unit tests
145145
------------------
146146

147-
Before submitting a pull request make sure that the tests still succeed with
148-
your change. Unit tests and functional tests run using the travis service and
149-
passing tests are mandatory to get merge requests accepted.
147+
Before submitting a pull request make sure that the tests and lint checks still succeed with
148+
your change. Unit tests and functional tests run in GitHub Actions and
149+
passing checks are mandatory to get merge requests accepted.
150150

151-
We're currently in a restructing phase for the unit tests. If you're changing existing
152-
tests, feel free to keep the current format. Otherwise please write new tests with pytest and
153-
using `responses
151+
Please write new unit tests with pytest and using `responses
154152
<https://github.com/getsentry/responses/>`_.
155-
An example for new tests can be found in tests/objects/test_runner.py
153+
An example can be found in ``tests/unit/objects/test_runner.py``
156154

157-
You need to install ``tox`` to run unit tests and documentation builds locally:
155+
You need to install ``tox`` (``pip3 install tox``) to run tests and lint checks locally:
158156

159157
.. code-block:: bash
160158
161-
# run the unit tests for all supported python3 versions, and the pep8 tests:
159+
# run unit tests using your installed python3, and all lint checks:
160+
tox -s
161+
162+
# run unit tests for all supported python3 versions, and all lint checks:
162163
tox
163164
164165
# run tests in one environment only:

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[tool.isort]
2+
profile = "black"
3+
multi_line_output = 3
4+
order_by_type = false
5+
16
[tool.semantic_release]
27
version_variable = "gitlab/__version__.py:__version__"
38
commit_subject = "chore: release v{version}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-r requirements.txt
2-
-r test-requirements.txt
2+
-r requirements-test.txt
33
docker-compose==1.29.2 # prevent inconsistent .env behavior from system install
44
pytest-console-scripts
55
pytest-docker
File renamed without changes.

requirements-lint.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
black
2+
flake8
3+
isort
4+
mypy
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
coverage
22
httmock
33
mock
4-
mypy
54
pytest
65
pytest-cov
76
responses

tox.ini

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,45 @@ usedevelop = True
1111
install_command = pip install {opts} {packages}
1212

1313
deps = -r{toxinidir}/requirements.txt
14-
-r{toxinidir}/test-requirements.txt
14+
-r{toxinidir}/requirements-test.txt
1515
commands =
1616
pytest tests/unit {posargs}
1717

1818
[testenv:pep8]
1919
basepython = python3
20-
deps = -r{toxinidir}/requirements.txt
21-
-r{toxinidir}/test-requirements.txt
22-
flake8
20+
envdir={toxworkdir}/lint
21+
deps = -r{toxinidir}/requirements-lint.txt
2322
commands =
2423
flake8 {posargs} .
2524

2625
[testenv:black]
2726
basepython = python3
28-
deps = -r{toxinidir}/requirements.txt
29-
-r{toxinidir}/test-requirements.txt
30-
black
27+
envdir={toxworkdir}/lint
28+
deps = -r{toxinidir}/requirements-lint.txt
3129
commands =
3230
black {posargs} .
3331

3432
[testenv:isort]
3533
basepython = python3
36-
deps = -r{toxinidir}/requirements.txt
37-
-r{toxinidir}/test-requirements.txt
38-
isort
34+
envdir={toxworkdir}/lint
35+
deps = -r{toxinidir}/requirements-lint.txt
3936
commands =
40-
isort --dont-order-by-type {posargs} {toxinidir}
37+
isort {posargs} {toxinidir}
4138

42-
[testenv:twine-check]
39+
[testenv:mypy]
4340
basepython = python3
44-
deps = -r{toxinidir}/requirements.txt
45-
-r{toxinidir}/test-requirements.txt
46-
twine
41+
envdir={toxworkdir}/lint
42+
deps = -r{toxinidir}/requirements-lint.txt
4743
commands =
48-
twine check dist/*
44+
mypy {posargs}
4945

50-
[testenv:mypy]
46+
[testenv:twine-check]
5147
basepython = python3
5248
deps = -r{toxinidir}/requirements.txt
53-
-r{toxinidir}/test-requirements.txt
49+
twine
5450
commands =
55-
mypy {posargs}
51+
python3 setup.py sdist bdist_wheel
52+
twine check dist/*
5653

5754
[testenv:venv]
5855
commands = {posargs}
@@ -68,12 +65,8 @@ ignore = E203,E501,W503
6865
per-file-ignores =
6966
gitlab/v4/objects/__init__.py:F401,F403
7067

71-
[isort]
72-
profile = black
73-
multi_line_output = 3
74-
7568
[testenv:docs]
76-
deps = -r{toxinidir}/rtd-requirements.txt
69+
deps = -r{toxinidir}/requirements-docs.txt
7770
commands = python setup.py build_sphinx
7871

7972
[testenv:cover]
@@ -95,11 +88,11 @@ exclude_lines =
9588
script_launch_mode = subprocess
9689

9790
[testenv:cli_func_v4]
98-
deps = -r{toxinidir}/docker-requirements.txt
91+
deps = -r{toxinidir}/requirements-docker.txt
9992
commands =
10093
pytest --cov --cov-report xml tests/functional/cli {posargs}
10194

10295
[testenv:py_func_v4]
103-
deps = -r{toxinidir}/docker-requirements.txt
96+
deps = -r{toxinidir}/requirements-docker.txt
10497
commands =
10598
pytest --cov --cov-report xml tests/functional/api {posargs}

0 commit comments

Comments
 (0)