summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-05-26 23:10:54 +0200
committerJohn Villalovos <john@sodarock.com>2021-05-29 20:36:57 -0700
commit237b97ceb0614821e59ea041f43a9806b65cdf8c (patch)
tree52ccdc258ce064fc164fe6c11aea0f122a85dbcd
parentb3d1c267cbe6885ee41b3c688d82890bb2e27316 (diff)
downloadgitlab-237b97ceb0614821e59ea041f43a9806b65cdf8c.tar.gz
chore: clean up tox, pre-commit and requirements
-rw-r--r--.github/workflows/docs.yml4
-rw-r--r--.pre-commit-config.yaml10
-rw-r--r--.readthedocs.yml2
-rw-r--r--MANIFEST.in5
-rw-r--r--README.rst19
-rw-r--r--pyproject.toml5
-rw-r--r--requirements-docker.txt (renamed from docker-requirements.txt)2
-rw-r--r--requirements-docs.txt (renamed from rtd-requirements.txt)0
-rw-r--r--requirements-lint.txt4
-rw-r--r--requirements-test.txt (renamed from test-requirements.txt)1
-rw-r--r--tox.ini45
11 files changed, 46 insertions, 51 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 22eec6a..7933b2b 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -40,6 +40,4 @@ jobs:
- name: Check twine readme rendering
env:
TOXENV: twine-check
- run: |
- python3 setup.py sdist bdist_wheel
- tox
+ run: tox
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index be403ea..e4893c3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -6,17 +6,13 @@ repos:
rev: 20.8b1
hooks:
- id: black
-
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v5.0.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
stages: [commit-msg]
-
- - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
- rev: v5.0.0
+ - repo: https://github.com/pycqa/isort
+ rev: 5.8.0
hooks:
- - id: commitlint-travis
- additional_dependencies: ['@commitlint/config-conventional']
- stages: [manual]
+ - id: isort
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 69f8c3a..1439594 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -10,4 +10,4 @@ formats:
python:
version: 3.8
install:
- - requirements: rtd-requirements.txt
+ - requirements: requirements-docs.txt
diff --git a/MANIFEST.in b/MANIFEST.in
index 27a83b3..5b36f87 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,4 @@
-include COPYING AUTHORS ChangeLog.rst RELEASE_NOTES.rst requirements.txt test-requirements.txt rtd-requirements.txt
-include tox.ini .travis.yml
+include COPYING AUTHORS ChangeLog.rst RELEASE_NOTES.rst requirements*.txt
+include tox.ini
recursive-include tests *
recursive-include docs *j2 *.py *.rst api/*.rst Makefile make.bat
-recursive-include tests/unit/data *
diff --git a/README.rst b/README.rst
index 016c7a9..36f0180 100644
--- a/README.rst
+++ b/README.rst
@@ -144,21 +144,22 @@ To format your code according to our guidelines before committing, run:
Running unit tests
------------------
-Before submitting a pull request make sure that the tests still succeed with
-your change. Unit tests and functional tests run using the travis service and
-passing tests are mandatory to get merge requests accepted.
+Before submitting a pull request make sure that the tests and lint checks still succeed with
+your change. Unit tests and functional tests run in GitHub Actions and
+passing checks are mandatory to get merge requests accepted.
-We're currently in a restructing phase for the unit tests. If you're changing existing
-tests, feel free to keep the current format. Otherwise please write new tests with pytest and
-using `responses
+Please write new unit tests with pytest and using `responses
<https://github.com/getsentry/responses/>`_.
-An example for new tests can be found in tests/objects/test_runner.py
+An example can be found in ``tests/unit/objects/test_runner.py``
-You need to install ``tox`` to run unit tests and documentation builds locally:
+You need to install ``tox`` (``pip3 install tox``) to run tests and lint checks locally:
.. code-block:: bash
- # run the unit tests for all supported python3 versions, and the pep8 tests:
+ # run unit tests using your installed python3, and all lint checks:
+ tox -s
+
+ # run unit tests for all supported python3 versions, and all lint checks:
tox
# run tests in one environment only:
diff --git a/pyproject.toml b/pyproject.toml
index eda0a12..448a4e3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,8 @@
+[tool.isort]
+profile = "black"
+multi_line_output = 3
+order_by_type = false
+
[tool.semantic_release]
version_variable = "gitlab/__version__.py:__version__"
commit_subject = "chore: release v{version}"
diff --git a/docker-requirements.txt b/requirements-docker.txt
index a3f5741..4ff5657 100644
--- a/docker-requirements.txt
+++ b/requirements-docker.txt
@@ -1,5 +1,5 @@
-r requirements.txt
--r test-requirements.txt
+-r requirements-test.txt
docker-compose==1.29.2 # prevent inconsistent .env behavior from system install
pytest-console-scripts
pytest-docker
diff --git a/rtd-requirements.txt b/requirements-docs.txt
index 9fd26ee..9fd26ee 100644
--- a/rtd-requirements.txt
+++ b/requirements-docs.txt
diff --git a/requirements-lint.txt b/requirements-lint.txt
new file mode 100644
index 0000000..c5000c7
--- /dev/null
+++ b/requirements-lint.txt
@@ -0,0 +1,4 @@
+black
+flake8
+isort
+mypy
diff --git a/test-requirements.txt b/requirements-test.txt
index 53456ad..8d61ad1 100644
--- a/test-requirements.txt
+++ b/requirements-test.txt
@@ -1,7 +1,6 @@
coverage
httmock
mock
-mypy
pytest
pytest-cov
responses
diff --git a/tox.ini b/tox.ini
index cbe69e7..1ddc331 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,48 +11,45 @@ usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
+ -r{toxinidir}/requirements-test.txt
commands =
pytest tests/unit {posargs}
[testenv:pep8]
basepython = python3
-deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
- flake8
+envdir={toxworkdir}/lint
+deps = -r{toxinidir}/requirements-lint.txt
commands =
flake8 {posargs} .
[testenv:black]
basepython = python3
-deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
- black
+envdir={toxworkdir}/lint
+deps = -r{toxinidir}/requirements-lint.txt
commands =
black {posargs} .
[testenv:isort]
basepython = python3
-deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
- isort
+envdir={toxworkdir}/lint
+deps = -r{toxinidir}/requirements-lint.txt
commands =
- isort --dont-order-by-type {posargs} {toxinidir}
+ isort {posargs} {toxinidir}
-[testenv:twine-check]
+[testenv:mypy]
basepython = python3
-deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
- twine
+envdir={toxworkdir}/lint
+deps = -r{toxinidir}/requirements-lint.txt
commands =
- twine check dist/*
+ mypy {posargs}
-[testenv:mypy]
+[testenv:twine-check]
basepython = python3
deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
+ twine
commands =
- mypy {posargs}
+ python3 setup.py sdist bdist_wheel
+ twine check dist/*
[testenv:venv]
commands = {posargs}
@@ -68,12 +65,8 @@ ignore = E203,E501,W503
per-file-ignores =
gitlab/v4/objects/__init__.py:F401,F403
-[isort]
-profile = black
-multi_line_output = 3
-
[testenv:docs]
-deps = -r{toxinidir}/rtd-requirements.txt
+deps = -r{toxinidir}/requirements-docs.txt
commands = python setup.py build_sphinx
[testenv:cover]
@@ -95,11 +88,11 @@ exclude_lines =
script_launch_mode = subprocess
[testenv:cli_func_v4]
-deps = -r{toxinidir}/docker-requirements.txt
+deps = -r{toxinidir}/requirements-docker.txt
commands =
pytest --cov --cov-report xml tests/functional/cli {posargs}
[testenv:py_func_v4]
-deps = -r{toxinidir}/docker-requirements.txt
+deps = -r{toxinidir}/requirements-docker.txt
commands =
pytest --cov --cov-report xml tests/functional/api {posargs}