mirror of
https://github.com/pretix/pretix.git
synced 2025-12-06 21:42:49 +00:00
Compare commits
14 Commits
raphaelm-p
...
actions-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df3fc1bef1 | ||
|
|
022cd8dff7 | ||
|
|
e9c3af9016 | ||
|
|
6744371417 | ||
|
|
b4005b7fe5 | ||
|
|
ff22b893f1 | ||
|
|
e37aba4f80 | ||
|
|
f9ae2fd62a | ||
|
|
621c84951f | ||
|
|
4d9f03dd2f | ||
|
|
9ac9a5aeef | ||
|
|
d5714e12f8 | ||
|
|
4f2cae5880 | ||
|
|
c9913a0153 |
4
.github/workflows/strings.yml
vendored
4
.github/workflows/strings.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install system packages
|
||||
run: sudo apt update && sudo apt -y install gettext
|
||||
run: sudo apt update && sudo apt install -y gettext
|
||||
- name: Install Dependencies
|
||||
run: pip3 install uv && uv pip install --system -e ".[dev]"
|
||||
- name: Compile messages
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install system packages
|
||||
run: sudo apt update && sudo apt install enchant-2 hunspell hunspell-de-de aspell-en aspell-de
|
||||
run: sudo apt update && sudo apt install -y enchant-2 hunspell hunspell-de-de aspell-en aspell-de
|
||||
- name: Install Dependencies
|
||||
run: pip3 install uv && uv pip install --system -e ".[dev]"
|
||||
- name: Spellcheck translations
|
||||
|
||||
5
.github/workflows/tests.yml
vendored
5
.github/workflows/tests.yml
vendored
@@ -22,6 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
name: Tests
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.9", "3.10", "3.11"]
|
||||
database: [sqlite, postgres]
|
||||
@@ -70,7 +71,7 @@ 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 --stepwise -vv -p no:sugar --cov=./ --cov-report=xml --reruns 0 tests
|
||||
- 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
|
||||
@@ -80,5 +81,5 @@ jobs:
|
||||
with:
|
||||
file: src/coverage.xml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: false
|
||||
fail_ci_if_error: true
|
||||
if: matrix.database == 'postgres' && matrix.python-version == '3.11'
|
||||
|
||||
@@ -88,7 +88,7 @@ dependencies = [
|
||||
"pytz-deprecation-shim==0.1.*",
|
||||
"pyuca",
|
||||
"qrcode==8.0",
|
||||
"redis==5.2.*",
|
||||
"redis==5.1.*",
|
||||
"reportlab==4.2.*",
|
||||
"requests==2.31.*",
|
||||
"sentry-sdk==2.17.*",
|
||||
@@ -102,7 +102,7 @@ dependencies = [
|
||||
"vat_moss_forked==2020.3.20.0.11.0",
|
||||
"vobject==0.9.*",
|
||||
"webauthn==2.2.*",
|
||||
"zeep==4.3.*"
|
||||
"zeep==4.2.*"
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
|
||||
import fakeredis
|
||||
@@ -39,9 +38,4 @@ def mocker_context():
|
||||
|
||||
|
||||
def get_redis_connection(alias="default", write=True):
|
||||
worker_id = os.environ.get("PYTEST_XDIST_WORKER")
|
||||
if worker_id.startswith("gw"):
|
||||
redis_port = 1000 + int(worker_id.replace("gw", ""))
|
||||
else:
|
||||
redis_port = 1000
|
||||
return fakeredis.FakeStrictRedis(server=fakeredis.FakeServer.get_server(f"127.0.0.1:{redis_port}:redis:v(7, 0)", (7, 0), server_type="redis"))
|
||||
return fakeredis.FakeStrictRedis(server=fakeredis.FakeServer.get_server("127.0.0.1:None:v(7, 0)", (7, 0), server_type="redis"))
|
||||
|
||||
@@ -95,5 +95,5 @@ class DisableMigrations(object):
|
||||
return None
|
||||
|
||||
|
||||
if not os.environ.get("GITHUB_WORKFLOW", ""):
|
||||
if not os.environ.get("TRAVIS", "") and not os.environ.get("GITHUB_WORKFLOW", ""):
|
||||
MIGRATION_MODULES = DisableMigrations()
|
||||
|
||||
@@ -23,6 +23,7 @@ import inspect
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from django.db import connection
|
||||
from django.test import override_settings
|
||||
from django.utils import translation
|
||||
from django_scopes import scopes_disabled
|
||||
@@ -37,8 +38,8 @@ CRASHED_ITEMS = set()
|
||||
@pytest.hookimpl(trylast=True)
|
||||
def pytest_configure(config):
|
||||
"""
|
||||
Somehow, somewhere, our test suite causes a segfault in SQLite in the past, but only when run
|
||||
on CI in full. Therefore, we monkeypatch pytest-xdist to retry segfaulted
|
||||
Somehow, somewhere, our test suite causes a segfault in SQLite, but only when run
|
||||
on Travis CI in full. Therefore, we monkeypatch pytest-xdist to retry segfaulted
|
||||
tests and keep fingers crossed that this doesn't turn into an infinite loop.
|
||||
"""
|
||||
|
||||
@@ -83,32 +84,27 @@ def reset_locale():
|
||||
|
||||
@pytest.fixture
|
||||
def fakeredis_client(monkeypatch):
|
||||
worker_id = os.environ.get("PYTEST_XDIST_WORKER")
|
||||
if worker_id.startswith("gw"):
|
||||
redis_port = 1000 + int(worker_id.replace("gw", ""))
|
||||
else:
|
||||
redis_port = 1000
|
||||
with override_settings(
|
||||
HAS_REDIS=True,
|
||||
REAL_CACHE_USED=True,
|
||||
CACHES={
|
||||
'redis': {
|
||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
||||
'LOCATION': f'redis://127.0.0.1:{redis_port}',
|
||||
'LOCATION': 'redis://127.0.0.1',
|
||||
'OPTIONS': {
|
||||
'connection_class': FakeConnection
|
||||
}
|
||||
},
|
||||
'redis_session': {
|
||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
||||
'LOCATION': f'redis://127.0.0.1:{redis_port}',
|
||||
'LOCATION': 'redis://127.0.0.1',
|
||||
'OPTIONS': {
|
||||
'connection_class': FakeConnection
|
||||
}
|
||||
},
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
||||
'LOCATION': f'redis://127.0.0.1:{redis_port}',
|
||||
'LOCATION': 'redis://127.0.0.1',
|
||||
'OPTIONS': {
|
||||
'connection_class': FakeConnection
|
||||
}
|
||||
@@ -119,3 +115,23 @@ def fakeredis_client(monkeypatch):
|
||||
redis.flushall()
|
||||
monkeypatch.setattr('django_redis.get_redis_connection', get_redis_connection, raising=False)
|
||||
yield redis
|
||||
|
||||
|
||||
if os.environ.get("GITHUB_WORKFLOW", ""):
|
||||
@pytest.fixture(autouse=True)
|
||||
def ensure_healthy_connection(request):
|
||||
# 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")
|
||||
|
||||
# Run actual test
|
||||
yield
|
||||
|
||||
# If yes, do a dummy query at the end of the test
|
||||
if marker:
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute("SELECT 1")
|
||||
|
||||
@@ -29,7 +29,7 @@ def test_crash():
|
||||
"""
|
||||
This is a test that crashes with SIGKILL every (n+1)-th time it runs (n = 0, 1, 2, …).
|
||||
This is useful for debugging our pytest-xdist monkeypatch that we apply in conftest.py
|
||||
to deal with random test crashes on CI using SQLite. Usually, this test is
|
||||
to deal with random test crashes on Travis CI using SQLite. Usually, this test is
|
||||
skipped to avoid causing additional crashes in real runs.
|
||||
"""
|
||||
if os.path.exists('crashed.tmp'):
|
||||
|
||||
Reference in New Issue
Block a user