Skip to content

Commit

Permalink
Python: Added verbose test flag for pytest (valkey-io#3214)
Browse files Browse the repository at this point in the history
added verbose flag for better pytest output

Signed-off-by: Edward Liang <edward.liang@improving.com>
  • Loading branch information
edlng authored Feb 20, 2025
1 parent 7f386f0 commit 8a507dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
source .env/bin/activate
pip install -r dev_requirements.txt
cd python/tests/
pytest --asyncio-mode=auto --html=pytest_report.html --self-contained-html
pytest -v --asyncio-mode=auto --html=pytest_report.html --self-contained-html
- uses: ./.github/workflows/test-benchmark
if: ${{ matrix.engine.version == '8.0' && matrix.host.OS == 'ubuntu' && matrix.host.RUNNER == 'ubuntu-latest' && matrix.python == '3.12' }}
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
source .env/bin/activate
pip install -r dev_requirements.txt
cd python/tests/
pytest --asyncio-mode=auto -k test_pubsub --html=pytest_report.html --self-contained-html
pytest -v --asyncio-mode=auto -k test_pubsub --html=pytest_report.html --self-contained-html
- name: Upload test reports
if: always()
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
run: |
source .env/bin/activate
cd python/tests/
pytest --asyncio-mode=auto --html=pytest_report.html --self-contained-html
pytest -v --asyncio-mode=auto --html=pytest_report.html --self-contained-html
- name: Upload test reports
if: always()
Expand Down Expand Up @@ -326,7 +326,7 @@ jobs:
run: |
source .env/bin/activate
cd python/tests/
pytest --asyncio-mode=auto --tls --cluster-endpoints=${{ secrets.MEMDB_MODULES_ENDPOINT }} -k server_modules --html=pytest_report.html --self-contained-html
pytest -v --asyncio-mode=auto --tls --cluster-endpoints=${{ secrets.MEMDB_MODULES_ENDPOINT }} -k server_modules --html=pytest_report.html --self-contained-html
- name: Upload test reports
if: always()
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ python-lint: .build/python_deps
--extend-ignore=E230

python-test: .build/python_deps check-redis-server
cd python && PYTHONPATH=$(PY_PATH):$(PY_GLIDE_PATH) .env/bin/pytest --asyncio-mode=auto
cd python && PYTHONPATH=$(PY_PATH):$(PY_GLIDE_PATH) .env/bin/pytest -v --asyncio-mode=auto

.build/python_deps:
@echo "$(GREEN)Generating protobuf files...$(RESET)"
Expand Down
6 changes: 3 additions & 3 deletions python/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ From a terminal, change directory to the GLIDE source folder and type:
cd $HOME/src/valkey-glide
cd python
source .env/bin/activate
pytest --asyncio-mode=auto
pytest -v --asyncio-mode=auto
```

To run modules tests:
Expand All @@ -142,15 +142,15 @@ To run modules tests:
cd $HOME/src/valkey-glide
cd python
source .env/bin/activate
pytest --asyncio-mode=auto -k "test_server_modules.py"
pytest -v --asyncio-mode=auto -k "test_server_modules.py"
```

**TIP:** to run a specific test, append `-k <test_name>` to the `pytest` execution line

To run tests against an already running servers, change the `pytest` line above to this:

```bash
pytest --asyncio-mode=auto --cluster-endpoints=localhost:7000 --standalone-endpoints=localhost:6379
pytest -v --asyncio-mode=auto --cluster-endpoints=localhost:7000 --standalone-endpoints=localhost:6379
```

# Generate protobuf files
Expand Down
10 changes: 5 additions & 5 deletions python/python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def pytest_addoption(parser):
help="""Load additional Valkey modules (provide full path for the module's shared library).
Use multiple times for multiple modules.
Example:
pytest --load-module=/path/to/module1.so --load-module=/path/to/module2.so""",
pytest -v --load-module=/path/to/module1.so --load-module=/path/to/module2.so""",
default=[],
)

Expand All @@ -75,8 +75,8 @@ def pytest_addoption(parser):
help="""Comma-separated list of cluster endpoints for standalone cluster in the format host1:port1,host2:port2,...
Note: The cluster will be flashed between tests.
Example:
pytest --asyncio-mode=auto --cluster-endpoints=127.0.0.1:6379
pytest --asyncio-mode=auto --cluster-endpoints=127.0.0.1:6379,127.0.0.1:6380
pytest -v --asyncio-mode=auto --cluster-endpoints=127.0.0.1:6379
pytest -v --asyncio-mode=auto --cluster-endpoints=127.0.0.1:6379,127.0.0.1:6380
""",
default=None,
)
Expand All @@ -87,8 +87,8 @@ def pytest_addoption(parser):
help="""Comma-separated list of cluster endpoints for cluster mode cluster in the format host1:port1,host2:port2,...
Note: The cluster will be flashed between tests.
Example:
pytest --asyncio-mode=auto --standalone-endpoints=127.0.0.1:6379
pytest --asyncio-mode=auto --standalone-endpoints=127.0.0.1:6379,127.0.0.1:6380
pytest -v --asyncio-mode=auto --standalone-endpoints=127.0.0.1:6379
pytest -v --asyncio-mode=auto --standalone-endpoints=127.0.0.1:6379,127.0.0.1:6380
""",
default=None,
)
Expand Down

0 comments on commit 8a507dc

Please sign in to comment.