From 8a507dcc7c5782ddcc1f4882a2b01a342e2eb260 Mon Sep 17 00:00:00 2001 From: Edward Liang <76571219+edlng@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:11:52 -0800 Subject: [PATCH] Python: Added verbose test flag for `pytest` (#3214) added verbose flag for better pytest output Signed-off-by: Edward Liang --- .github/workflows/python.yml | 8 ++++---- Makefile | 2 +- python/DEVELOPER.md | 6 +++--- python/python/tests/conftest.py | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index c30bf6190c..d9ab60745c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -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' }} @@ -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() @@ -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() @@ -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() diff --git a/Makefile b/Makefile index 34cda465fe..419c637c79 100644 --- a/Makefile +++ b/Makefile @@ -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)" diff --git a/python/DEVELOPER.md b/python/DEVELOPER.md index 38cbb186f6..9ca01914fa 100644 --- a/python/DEVELOPER.md +++ b/python/DEVELOPER.md @@ -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: @@ -142,7 +142,7 @@ 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 ` to the `pytest` execution line @@ -150,7 +150,7 @@ pytest --asyncio-mode=auto -k "test_server_modules.py" 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 diff --git a/python/python/tests/conftest.py b/python/python/tests/conftest.py index 2e25eb622d..d20992f682 100644 --- a/python/python/tests/conftest.py +++ b/python/python/tests/conftest.py @@ -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=[], ) @@ -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, ) @@ -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, )