forked from CGM_Public/pretix_original
Compare commits
14 Commits
raphaelm-p
...
hacky-debu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65c5b088dd | ||
|
|
28f20805b0 | ||
|
|
80d1dd16f4 | ||
|
|
82ed8abecc | ||
|
|
c0849c9d9c | ||
|
|
e3f6b3f70a | ||
|
|
67934e51fc | ||
|
|
d4ea0990b3 | ||
|
|
9b4506d5e5 | ||
|
|
f559cd2618 | ||
|
|
33991cfb77 | ||
|
|
fe12eea591 | ||
|
|
7000d4897d | ||
|
|
e6337e07e1 |
13
.github/workflows/tests.yml
vendored
13
.github/workflows/tests.yml
vendored
@@ -22,9 +22,10 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
name: Tests
|
name: Tests
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.9", "3.10", "3.11"]
|
python-version: ["3.9", "3.10", "3.11"]
|
||||||
database: [sqlite, postgres]
|
database: [ postgres]
|
||||||
exclude:
|
exclude:
|
||||||
- database: sqlite
|
- database: sqlite
|
||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
@@ -70,7 +71,13 @@ jobs:
|
|||||||
run: make all compress
|
run: make all compress
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
working-directory: ./src
|
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 3 tests --maxfail=100 || true
|
||||||
|
|
||||||
|
# XXXXXXXXXXXXXX for test only
|
||||||
|
- name: print debug output
|
||||||
|
working-directory: ./src
|
||||||
|
run: cat /tmp/test.txt
|
||||||
|
|
||||||
- name: Run concurrency tests
|
- name: Run concurrency tests
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reruns 0 --reuse-db
|
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reruns 0 --reuse-db
|
||||||
@@ -80,5 +87,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
file: src/coverage.xml
|
file: src/coverage.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: true
|
||||||
if: matrix.database == 'postgres' && matrix.python-version == '3.11'
|
if: matrix.database == 'postgres' && matrix.python-version == '3.11'
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ dependencies = [
|
|||||||
"pytz-deprecation-shim==0.1.*",
|
"pytz-deprecation-shim==0.1.*",
|
||||||
"pyuca",
|
"pyuca",
|
||||||
"qrcode==8.0",
|
"qrcode==8.0",
|
||||||
"redis==5.2.*",
|
"redis==5.1.*",
|
||||||
"reportlab==4.2.*",
|
"reportlab==4.2.*",
|
||||||
"requests==2.31.*",
|
"requests==2.31.*",
|
||||||
"sentry-sdk==2.17.*",
|
"sentry-sdk==2.17.*",
|
||||||
@@ -102,7 +102,7 @@ dependencies = [
|
|||||||
"vat_moss_forked==2020.3.20.0.11.0",
|
"vat_moss_forked==2020.3.20.0.11.0",
|
||||||
"vobject==0.9.*",
|
"vobject==0.9.*",
|
||||||
"webauthn==2.2.*",
|
"webauthn==2.2.*",
|
||||||
"zeep==4.3.*"
|
"zeep==4.2.*"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
|||||||
@@ -21,8 +21,10 @@
|
|||||||
#
|
#
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from django.db import connection
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
from django_scopes import scopes_disabled
|
from django_scopes import scopes_disabled
|
||||||
@@ -119,3 +121,33 @@ def fakeredis_client(monkeypatch):
|
|||||||
redis.flushall()
|
redis.flushall()
|
||||||
monkeypatch.setattr('django_redis.get_redis_connection', get_redis_connection, raising=False)
|
monkeypatch.setattr('django_redis.get_redis_connection', get_redis_connection, raising=False)
|
||||||
yield redis
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user