Skip to content

Commit

Permalink
fix test requirements and simplified tox config
Browse files Browse the repository at this point in the history
  • Loading branch information
R Max Espinoza committed Jul 2, 2024
1 parent 48a7a89 commit c7b93e0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 40 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ jobs:
matrix:
python-version: ["3.11.3"]

services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2

Expand All @@ -21,8 +30,9 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Run pytest
env:
env:
TOXENV: pytest
REDIS_HOST: redis
run: |
pip install -U tox
tox
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.3
0.7.3
4 changes: 2 additions & 2 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This packages are required to run all the tests.
flake8
mock
pytest
pytest>=6.0,<7
pytest-cov
tox
tox>=3.0,<4
2 changes: 1 addition & 1 deletion tests/test_scrapy_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


# allow test settings from environment
REDIS_HOST = os.environ.get('REDIST_HOST', 'localhost')
REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost')
REDIS_PORT = int(os.environ.get('REDIS_PORT', 6379))


Expand Down
61 changes: 26 additions & 35 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[tox]
envlist = security,flake8,py{38,39,310,311}-scrapy{26,27,28,29}-redis{42,43,44,45}
minversion = 1.7.0
envlist =
security
flake8
py{38,39,310,311}-scrapy{26,27,28,29}-redis{42,43,44,45,46,50}
minversion = 3.0.0

[base]
deps =
scrapy>=2.6
redis>=4.2
six>=1.5.2
-r requirements-tests.txt
-r requirements.txt

[testenv]
basepython =
Expand All @@ -16,26 +18,26 @@ basepython =
py311: python3.11
deps =
{[base]deps}
mock
pytest
pytest-cov
scrapy26: scrapy~=2.6.0
scrapy27: scrapy~=2.7.0
scrapy28: scrapy~=2.8.0
scrapy29: scrapy~=2.9.0
scrapy210: scrapy~=2.10.0
scrapy211: scrapy~=2.11.0
redis42: redis~=4.2.0
redis43: redis~=4.3.0
redis44: redis~=4.4.0
redis45: redis~=4.5.0
redis46: redis~=4.6.0
redis50: redis~=5.0.0
commands =
scrapy26: pip install scrapy==2.6.3
scrapy27: pip install scrapy==2.7.1
scrapy28: pip install scrapy==2.8.0
scrapy29: pip install scrapy==2.9.0
redis42: pip install redis==4.2.0
redis43: pip install redis==4.3.6
redis44: pip install redis==4.4.4
redis45: pip install redis==4.5.5
pip install .
python -m pytest # --cov-report term --cov=scrapy_redis

[testenv:flake8]
basepython = python3.11
basepython =
python3.11
deps =
{[base]deps}
flake8 # https://github.com/tholo/pytest-flake8/issues/81
commands =
flake8 --ignore=W503,E265,E731 docs/ tests/

Expand All @@ -46,31 +48,20 @@ deps =
commands =
bandit -r -c .bandit.yml src/ tests/

[testenv:pylint]
basepython = python3.11
deps =
{[base]deps}
pylint==2.12.2
commands =
pylint setup.py docs/ src/ tests/

[testenv:pytest]
basepython = python3.11
deps =
{[testenv]deps}
scrapy==2.6.1
redis==4.2.2
allowlist_externals = sudo
commands =
sudo apt-get update
sudo apt-get install -y redis
sudo systemctl start redis-server
pip install .
python -m pytest --cov-report term --cov=scrapy_redis

[testenv:build]
basepython=python3.11
deps =
{[base]deps}
commands =
allowlist_externals = sudo
commands =
sudo apt-get update
sudo apt-get install -y redis
sudo systemctl start redis-server
pip install .

0 comments on commit c7b93e0

Please sign in to comment.