Compare commits

...

13 Commits

Author SHA1 Message Date
Mira Weller
b23fdf2000 rename 2024-10-25 18:01:11 +02:00
Mira
80d1dd16f4 Merge branch 'master' into hacky-debug-output 2024-10-25 17:57:06 +02:00
dependabot[bot]
82ed8abecc Update fakeredis requirement from ==2.24.* to ==2.26.* (#4551)
Updates the requirements on [fakeredis](https://github.com/cunla/fakeredis-py) to permit the latest version.
- [Release notes](https://github.com/cunla/fakeredis-py/releases)
- [Commits](https://github.com/cunla/fakeredis-py/compare/v2.24.0...v2.26.0)

---
updated-dependencies:
- dependency-name: fakeredis
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-25 17:55:13 +02:00
Mira Weller
c0849c9d9c disable reruns 2024-10-25 17:33:36 +02:00
Raphael Michel
e3f6b3f70a pytest: Fix failure with fakeserver and xdist 2024-10-25 17:30:47 +02:00
Mira
67934e51fc Merge branch 'master' into hacky-debug-output 2024-10-25 17:08:02 +02:00
Mira Weller
d4ea0990b3 readd matrix 2024-10-25 17:03:55 +02:00
Raphael Michel
9b4506d5e5 Speed up process with uv 2024-10-25 17:02:22 +02:00
Mira Weller
f559cd2618 flush, always print 2024-10-25 17:01:33 +02:00
Mira Weller
33991cfb77 add some hacky debug output 2024-10-25 16:43:21 +02:00
Mira Weller
fe12eea591 Revert "Update fakeredis requirement from ==2.24.* to ==2.26.* (#4551)"
This reverts commit cf3087453c.
2024-10-25 16:06:21 +02:00
Mira Weller
7000d4897d Revert "Fix fakeredis usage"
This reverts commit 39c3aef7bc.
2024-10-25 16:06:20 +02:00
Mira Weller
e6337e07e1 Revert "pytest: Fix failure with fakeserver and xdist"
This reverts commit b46c0eba0c.
2024-10-25 16:06:19 +02:00
2 changed files with 41 additions and 2 deletions

View File

@@ -22,9 +22,10 @@ jobs:
runs-on: ubuntu-22.04
name: Tests
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
database: [sqlite, postgres]
database: [ postgres]
exclude:
- database: sqlite
python-version: "3.9"
@@ -70,7 +71,13 @@ jobs:
run: make all compress
- name: Run tests
working-directory: ./src
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test -n 3 -p no:sugar --cov=./ --cov-report=xml --reruns 3 tests --maxfail=100
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test -n 3 -p no:sugar --cov=./ --cov-report=xml --reruns 0 tests --maxfail=100 || true
# XXXXXXXXXXXXXX for test only
- name: print debug output
working-directory: ./src
run: cat /tmp/test.txt
- name: Run concurrency tests
working-directory: ./src
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reruns 0 --reuse-db

View File

@@ -21,8 +21,10 @@
#
import inspect
import os
import time
import pytest
from django.db import connection
from django.test import override_settings
from django.utils import translation
from django_scopes import scopes_disabled
@@ -119,3 +121,33 @@ def fakeredis_client(monkeypatch):
redis.flushall()
monkeypatch.setattr('django_redis.get_redis_connection', get_redis_connection, raising=False)
yield redis
# XXXXXXXXXXXXXXXXXXX for test only
f = open("/tmp/test.txt","w")
if os.environ.get("GITHUB_WORKFLOW", ""):
@pytest.fixture(autouse=True)
def ensure_healthy_connection(request, worker_id):
# We have no idea why this is neccessary. It shouldn't be, and it costs some performance.
# However, in ~August 2024 our tests became really flake on GitHub Actions (failing more than 80% of the time)
# for no apparent reason with some error messages related to PostgreSQL connection issues. This appears to
# work around it...
# Check if the test even has DB access
marker = request.node.get_closest_marker("django_db")
f.write(str(time.time())+"\t"+ str(worker_id)+"\t"+str(request.path)+"\t"+ str(request.module.__name__)+"\t"+ str(request.function.__name__)+"\tstart\n")
f.flush()
# Run actual test
yield
f.write(str(time.time())+"\t"+ str(worker_id)+"\t"+str(request.path)+"\t"+ str(request.module.__name__)+"\t"+ str(request.function.__name__)+"\tend\n")
f.flush()
# If yes, do a dummy query at the end of the test
#if marker:
# with connection.cursor() as cursor:
# cursor.execute("SELECT 1")