Skip to content

Commit

Permalink
replace pyinvoke with tox
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Koviazin <[email protected]>
  • Loading branch information
mkmkme committed Oct 1, 2024
1 parent 42a9c44 commit c347e2c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 105 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
sudo apt-get install -yqq pandoc make
- name: run code linters
run: |
pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt
invoke build-docs
pip install tox
tox -e doc
- name: upload docs
uses: actions/upload-artifact@v4
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
cache: 'pip'
- name: run code linters
run: |
pip install -r dev_requirements.txt
invoke linters
pip install tox
tox -e lint
populate-cache:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -103,22 +103,24 @@ jobs:
run: docker image load -i ./custom-cache/all.tar

- name: run tests
env:
# Set CI to true to avoid pytest from truncating "short test summary info"
# (see https://github.com/pytest-dev/pytest/pull/9933)
CI: True
run: |
pip install -U setuptools wheel
pip install -r requirements.txt
pip install -r dev_requirements.txt
pip install tox
if [ "${{matrix.connection-type}}" == "libvalkey" ]; then
pip install "libvalkey>=4.0.0"
fi
invoke devenv
tox -e docker
if [[ "${{matrix.test-type}}" == "standalone" ]]; then
./util/wait-for-it.sh localhost:6379
else
./util/wait-for-it.sh localhost:16379
fi
invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }}
tox -e ${{matrix.test-type}}-nouvloop-protocol${{matrix.protocol-version}}
if [[ "${{matrix.python-version}}" != pypy-* ]]; then
invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }}
tox -e ${{matrix.test-type}}-uvloop-protocol${{matrix.protocol-version}}
fi
- uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vagrant/.vagrant
env
venv
coverage.xml
.tox/
.venv*
*.xml
.coverage*
Expand Down
1 change: 0 additions & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ click
flake8-isort
flake8
flynt
invoke
mock
packaging>=20.4
pytest
Expand Down
94 changes: 0 additions & 94 deletions tasks.py

This file was deleted.

58 changes: 58 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[tox]
env_list = lint, standalone-{uvloop,nouvloop}-protocol{2,3}

[testenv:doc]
description = Build documentation
deps = -rdocs/requirements.txt
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html

[testenv:docker]
description = Set up development environment
allowlist_externals = docker
commands =
docker compose --profile all up -d


[testenv:lint]
description = Run linters
deps =
black
flake8
flynt
isort
vulture
commands =
black --target-version py37 --check --diff tests valkey
flake8 tests valkey
isort --check-only --diff tests valkey
vulture valkey whitelist.py --min-confidence 80
flynt --fail-on-change --dry-run tests valkey

[testenv:standalone-{uvloop,nouvloop}-protocol{2,3}]
description = Run standalone tests
deps =
pytest
-rdev_requirements.txt
passenv = CI
setenv =
uvloop: VALKEY_UVLOOP=uvloop
nouvloop: VALKEY_UVLOOP=no-uvloop
protocol2: VALKEY_PROTOCOL=2
protocol3: VALKEY_PROTOCOL=3
commands =
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}

[testenv:cluster-{uvloop,nouvloop}-protocol{2,3}]
description = Run cluster tests
deps =
pytest
-rdev_requirements.txt
passenv = CI
setenv =
uvloop: VALKEY_UVLOOP=uvloop
nouvloop: VALKEY_UVLOOP=no-uvloop
protocol2: VALKEY_PROTOCOL=2
protocol3: VALKEY_PROTOCOL=3
commands =
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 comments on commit c347e2c

Please sign in to comment.