Skip to content

Commit c347e2c

Browse files
committed
replace pyinvoke with tox
Signed-off-by: Mikhail Koviazin <[email protected]>
1 parent 42a9c44 commit c347e2c

File tree

6 files changed

+71
-105
lines changed

6 files changed

+71
-105
lines changed

.github/workflows/docs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
sudo apt-get install -yqq pandoc make
3737
- name: run code linters
3838
run: |
39-
pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt
40-
invoke build-docs
39+
pip install tox
40+
tox -e doc
4141
4242
- name: upload docs
4343
uses: actions/upload-artifact@v4

.github/workflows/integration.yaml

+10-8
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
cache: 'pip'
4848
- name: run code linters
4949
run: |
50-
pip install -r dev_requirements.txt
51-
invoke linters
50+
pip install tox
51+
tox -e lint
5252
5353
populate-cache:
5454
runs-on: ubuntu-latest
@@ -103,22 +103,24 @@ jobs:
103103
run: docker image load -i ./custom-cache/all.tar
104104

105105
- name: run tests
106+
env:
107+
# Set CI to true to avoid pytest from truncating "short test summary info"
108+
# (see https://github.com/pytest-dev/pytest/pull/9933)
109+
CI: True
106110
run: |
107-
pip install -U setuptools wheel
108-
pip install -r requirements.txt
109-
pip install -r dev_requirements.txt
111+
pip install tox
110112
if [ "${{matrix.connection-type}}" == "libvalkey" ]; then
111113
pip install "libvalkey>=4.0.0"
112114
fi
113-
invoke devenv
115+
tox -e docker
114116
if [[ "${{matrix.test-type}}" == "standalone" ]]; then
115117
./util/wait-for-it.sh localhost:6379
116118
else
117119
./util/wait-for-it.sh localhost:16379
118120
fi
119-
invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }}
121+
tox -e ${{matrix.test-type}}-nouvloop-protocol${{matrix.protocol-version}}
120122
if [[ "${{matrix.python-version}}" != pypy-* ]]; then
121-
invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }}
123+
tox -e ${{matrix.test-type}}-uvloop-protocol${{matrix.protocol-version}}
122124
fi
123125
124126
- uses: actions/upload-artifact@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ vagrant/.vagrant
1313
env
1414
venv
1515
coverage.xml
16+
.tox/
1617
.venv*
1718
*.xml
1819
.coverage*

dev_requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ click
44
flake8-isort
55
flake8
66
flynt
7-
invoke
87
mock
98
packaging>=20.4
109
pytest

tasks.py

-94
This file was deleted.

tox.ini

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[tox]
2+
env_list = lint, standalone-{uvloop,nouvloop}-protocol{2,3}
3+
4+
[testenv:doc]
5+
description = Build documentation
6+
deps = -rdocs/requirements.txt
7+
commands =
8+
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
9+
10+
[testenv:docker]
11+
description = Set up development environment
12+
allowlist_externals = docker
13+
commands =
14+
docker compose --profile all up -d
15+
16+
17+
[testenv:lint]
18+
description = Run linters
19+
deps =
20+
black
21+
flake8
22+
flynt
23+
isort
24+
vulture
25+
commands =
26+
black --target-version py37 --check --diff tests valkey
27+
flake8 tests valkey
28+
isort --check-only --diff tests valkey
29+
vulture valkey whitelist.py --min-confidence 80
30+
flynt --fail-on-change --dry-run tests valkey
31+
32+
[testenv:standalone-{uvloop,nouvloop}-protocol{2,3}]
33+
description = Run standalone tests
34+
deps =
35+
pytest
36+
-rdev_requirements.txt
37+
passenv = CI
38+
setenv =
39+
uvloop: VALKEY_UVLOOP=uvloop
40+
nouvloop: VALKEY_UVLOOP=no-uvloop
41+
protocol2: VALKEY_PROTOCOL=2
42+
protocol3: VALKEY_PROTOCOL=3
43+
commands =
44+
pytest --protocol={env:VALKEY_PROTOCOL} --cov=./ --cov-report=xml:coverage_valkey.xml -W always -m 'not onlycluster' --junit-xml=standalone-{env:VALKEY_UVLOOP}-results.xml {posargs:tests}
45+
46+
[testenv:cluster-{uvloop,nouvloop}-protocol{2,3}]
47+
description = Run cluster tests
48+
deps =
49+
pytest
50+
-rdev_requirements.txt
51+
passenv = CI
52+
setenv =
53+
uvloop: VALKEY_UVLOOP=uvloop
54+
nouvloop: VALKEY_UVLOOP=no-uvloop
55+
protocol2: VALKEY_PROTOCOL=2
56+
protocol3: VALKEY_PROTOCOL=3
57+
commands =
58+
pytest --protocol={env:VALKEY_PROTOCOL} --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not valkeymod' --valkey-url=valkey://localhost:16379/0 --junit-xml=cluster-{env:VALKEY_UVLOOP}-results.xml {posargs:tests}

0 commit comments

Comments
 (0)