summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Parise <jon@pinterest.com>2022-02-15 15:22:43 -0800
committerGitHub <noreply@github.com>2022-02-15 15:22:43 -0800
commit900fc18db76a4e20c77f748bcffff2055231a3b5 (patch)
tree702438eaabe101cfc198b9b1b6cca6d4e335a638
parent4611e0b01589cb7b4c18455fd0805204d320e11e (diff)
downloadpymemcache-900fc18db76a4e20c77f748bcffff2055231a3b5.tar.gz
Revise tox configuration (#375)
This repositions tox as the "source of truth" for all development and CI actions. To support this, lint and test requirements have been split into separate sets of requirements, and a consolidated 'lint' environment now runs all of our lint checks. This is also used by CI.
-rw-r--r--.github/workflows/ci.yml9
-rw-r--r--lint-requirements.txt4
-rw-r--r--setup.cfg4
-rw-r--r--test-requirements.txt1
-rw-r--r--tox.ini47
5 files changed, 30 insertions, 35 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a1d3ff4..6ee0977 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,24 +24,23 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
- key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('setup.py') }}-${{ hashFiles('*-requirements.txt') }}
+ key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('.github/workflows/ci.yml') }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
+ python -m pip install tox tox-gh-actions
sudo apt-get install libmemcached-dev
- name: Lint
if: matrix.python-version == '3.10'
run: |
- pip install tox tox-gh-actions
- tox -e flake8,black
+ tox -e lint
- name: Disable IPv6 localhost
run: |
sudo sed -i '/::1/d' /etc/hosts
- name: Tests
run: |
- pip install -r test-requirements.txt
- py.test pymemcache/test/ \
+ tox -- pymemcache/test/ \
-m 'unit or integration' \
--port ${{ job.services.memcached.ports[11211] }} \
--tls-port ${{ job.services.tls_memcached.ports[11211] }}
diff --git a/lint-requirements.txt b/lint-requirements.txt
new file mode 100644
index 0000000..e49932d
--- /dev/null
+++ b/lint-requirements.txt
@@ -0,0 +1,4 @@
+black==22.1.0
+docutils==0.18.1
+flake8==4.0.1
+pygments==2.11.2
diff --git a/setup.cfg b/setup.cfg
index 812c89c..931608f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -42,8 +42,10 @@ markers =
unit
integration
benchmark
+testpaths =
+ pymemcache/test
[flake8]
show-source = True
-exclude = .tox/*,.venv/*,docs/*
+exclude = .eggs/*,.tox/*,.venv/*,docs/*
extend-ignore = E203, E501
diff --git a/test-requirements.txt b/test-requirements.txt
index d2c5d88..e60ba3f 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,4 +1,3 @@
-black==22.1.0
pytest==7.0.1
pytest-cov==3.0.0
gevent==21.12.0; "PyPy" not in platform_python_implementation
diff --git a/tox.ini b/tox.ini
index 8cdb1d2..388c35a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,47 +1,38 @@
[tox]
-envlist = py37, py38, py39, py310, pypy3, flake8, black, integration
-skip_missing_interpreters = True
-# Automatic envs (pyXX) will only use the python version appropriate to that
-# env and ignore basepython inherited from [testenv] if we set
-# ignore_basepython_conflict.
-ignore_basepython_conflict = True
+envlist =
+ py37,
+ py38,
+ py39,
+ py310,
+ pypy3,
+ docs,
+ lint,
+ venv,
+skip_missing_interpreters = true
[gh-actions]
python =
pypy-3.7: pypy3
[testenv]
-basepython = python3
-setenv =
- PYTHONPATH = {toxinidir}
+description = run tests with {basepython}
deps = -r{toxinidir}/test-requirements.txt
+skip_install = True
commands =
- pip install -e .
- py.test {posargs:pymemcache/test/}
+ python -m pytest {posargs}
-[testenv:integration]
-commands =
- pip install -e .
- py.test {posargs:pymemcache/test/ -m integration}
-
-[testenv:flake8]
-# Avoid pulling all the base requirements only to run flake8
-deps = flake8
+[testenv:lint]
+description = lint source code
+deps = -r{toxinidir}/lint-requirements.txt
commands =
+ python setup.py check --metadata --restructuredtext --strict
flake8
- python setup.py check --restructuredtext
-
-[testenv:black]
-commands =
black --check .
-[testenv:coverage]
-commands =
- py.test --cov=pymemcache
-
[testenv:docs]
+description = invoke sphinx-build to build the HTML docs
+deps = -r{toxinidir}/docs-requirements.txt
commands =
- pip install -r docs-requirements.txt
sphinx-build -b html docs/ docs/_build/html
[testenv:venv]