forked from CGM_Public/pretix_original
Compare commits
3 Commits
hacky-debu
...
raphaelm-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a779ba7819 | ||
|
|
ae5111ee7e | ||
|
|
d8bf3065d0 |
13
.github/workflows/tests.yml
vendored
13
.github/workflows/tests.yml
vendored
@@ -22,10 +22,9 @@ 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: [ postgres]
|
database: [sqlite, postgres]
|
||||||
exclude:
|
exclude:
|
||||||
- database: sqlite
|
- database: sqlite
|
||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
@@ -71,13 +70,7 @@ 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 || true
|
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
|
||||||
|
|
||||||
# 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
|
||||||
@@ -87,5 +80,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
file: src/coverage.xml
|
file: src/coverage.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: false
|
||||||
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.1.*",
|
"redis==5.2.*",
|
||||||
"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.2.*"
|
"zeep==4.3.*"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
|||||||
@@ -21,10 +21,8 @@
|
|||||||
#
|
#
|
||||||
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
|
||||||
@@ -121,33 +119,3 @@ 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