forked from CGM_Public/pretix_original
Compare commits
7 Commits
actions-de
...
ci-more-th
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90a34b3382 | ||
|
|
482a66c546 | ||
|
|
e4cef6e46b | ||
|
|
cbee1b71fe | ||
|
|
0cd1290624 | ||
|
|
565f5e2ea7 | ||
|
|
b46c0eba0c |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: sudo apt update && sudo apt install gettext unzip
|
run: sudo apt update && sudo apt install -y gettext unzip
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: pip3 install -U setuptools build pip check-manifest
|
run: pip3 install -U setuptools build pip check-manifest
|
||||||
- name: Run check-manifest
|
- name: Run check-manifest
|
||||||
|
|||||||
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
- name: Install system packages
|
- name: Install system packages
|
||||||
run: sudo apt update && sudo apt install enchant-2 hunspell aspell-en
|
run: sudo apt update && sudo apt install -y enchant-2 hunspell aspell-en
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip3 install -Ur requirements.txt
|
run: pip3 install -Ur requirements.txt
|
||||||
working-directory: ./doc
|
working-directory: ./doc
|
||||||
|
|||||||
6
.github/workflows/strings.yml
vendored
6
.github/workflows/strings.yml
vendored
@@ -35,9 +35,9 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
- name: Install system packages
|
- name: Install system packages
|
||||||
run: sudo apt update && sudo apt install gettext
|
run: sudo apt update && sudo apt -y install gettext
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip3 install -e ".[dev]"
|
run: pip3 install uv && uv pip install --system -e ".[dev]"
|
||||||
- name: Compile messages
|
- name: Compile messages
|
||||||
run: python manage.py compilemessages
|
run: python manage.py compilemessages
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
- name: Install system packages
|
- 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 enchant-2 hunspell hunspell-de-de aspell-en aspell-de
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip3 install -e ".[dev]"
|
run: pip3 install uv && uv pip install --system -e ".[dev]"
|
||||||
- name: Spellcheck translations
|
- name: Spellcheck translations
|
||||||
run: potypo
|
run: potypo
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
|
|||||||
4
.github/workflows/style.yml
vendored
4
.github/workflows/style.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip3 install -e ".[dev]" psycopg2-binary
|
run: pip3 install uv && uv pip install --system -e ".[dev]" psycopg2-binary
|
||||||
- name: Run isort
|
- name: Run isort
|
||||||
run: isort -c .
|
run: isort -c .
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: pip3 install -e ".[dev]" psycopg2-binary
|
run: pip3 install uv && uv pip install --system -e ".[dev]" psycopg2-binary
|
||||||
- name: Run flake8
|
- name: Run flake8
|
||||||
run: flake8 .
|
run: flake8 .
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
|
|||||||
27
.github/workflows/tests.yml
vendored
27
.github/workflows/tests.yml
vendored
@@ -22,7 +22,6 @@ 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: [sqlite, postgres]
|
||||||
@@ -31,15 +30,21 @@ jobs:
|
|||||||
python-version: "3.9"
|
python-version: "3.9"
|
||||||
- database: sqlite
|
- database: sqlite
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: pretix
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: harmon758/postgresql-action@v1
|
|
||||||
with:
|
|
||||||
postgresql version: '15'
|
|
||||||
postgresql db: 'pretix'
|
|
||||||
postgresql user: 'postgres'
|
|
||||||
postgresql password: 'postgres'
|
|
||||||
if: matrix.database == 'postgres'
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
@@ -51,9 +56,9 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: sudo apt update && sudo apt install gettext
|
run: sudo apt update && sudo apt install -y gettext
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: pip3 install --ignore-requires-python -e ".[dev]" psycopg2-binary # We ignore that flake8 needs newer python as we don't run flake8 during tests
|
run: pip3 install uv && uv pip install --system -e ".[dev]" psycopg2-binary
|
||||||
- name: Run checks
|
- name: Run checks
|
||||||
run: python manage.py check
|
run: python manage.py check
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
@@ -65,7 +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/travis_${{ matrix.database }}.cfg py.test -vv -n 3 -p no:sugar --cov=./ --cov-report=xml --reruns 3 tests --maxfail=100
|
run: PRETIX_CONFIG_FILE=tests/travis_${{ matrix.database }}.cfg py.test -n 4 -p no:sugar --cov=./ --cov-report=xml --reruns 3 tests --maxfail=100
|
||||||
- name: Run concurrency tests
|
- name: Run concurrency tests
|
||||||
working-directory: ./src
|
working-directory: ./src
|
||||||
run: PRETIX_CONFIG_FILE=tests/travis_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reruns 0 --reuse-db
|
run: PRETIX_CONFIG_FILE=tests/travis_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reruns 0 --reuse-db
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ def event_list(request):
|
|||||||
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
||||||
).annotate(
|
).annotate(
|
||||||
order_from=Coalesce('min_from', 'date_from'),
|
order_from=Coalesce('min_from', 'date_from'),
|
||||||
).order_by('-order_from')
|
).order_by('-order_from', 'slug')
|
||||||
|
|
||||||
total = qs.count()
|
total = qs.count()
|
||||||
pagesize = 20
|
pagesize = 20
|
||||||
@@ -318,7 +318,7 @@ def nav_context_list(request):
|
|||||||
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
||||||
).annotate(
|
).annotate(
|
||||||
order_from=Coalesce('min_from', 'date_from'),
|
order_from=Coalesce('min_from', 'date_from'),
|
||||||
).order_by('-order_from')
|
).order_by('-order_from', 'slug')
|
||||||
|
|
||||||
if request.user.has_active_staff_session(request.session.session_key):
|
if request.user.has_active_staff_session(request.session.session_key):
|
||||||
qs_orga = Organizer.objects.all()
|
qs_orga = Organizer.objects.all()
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ class EventListMixin:
|
|||||||
)
|
)
|
||||||
).annotate(
|
).annotate(
|
||||||
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
||||||
).order_by('-order_to')
|
).order_by('-order_to', 'name', 'slug')
|
||||||
else:
|
else:
|
||||||
date_q = Q(date_to__gte=now()) | (Q(date_to__isnull=True) & Q(date_from__gte=now()))
|
date_q = Q(date_to__gte=now()) | (Q(date_to__isnull=True) & Q(date_from__gte=now()))
|
||||||
qs = qs.filter(
|
qs = qs.filter(
|
||||||
@@ -219,7 +219,7 @@ class EventListMixin:
|
|||||||
)
|
)
|
||||||
).annotate(
|
).annotate(
|
||||||
order_from=Coalesce('min_from', 'date_from'),
|
order_from=Coalesce('min_from', 'date_from'),
|
||||||
).order_by('order_from')
|
).order_by('order_from', 'name', 'slug')
|
||||||
qs = Event.annotated(filter_qs_by_attr(
|
qs = Event.annotated(filter_qs_by_attr(
|
||||||
qs, self.request, match_subevents_with_conditions=Q(active=True) & Q(is_public=True) & date_q
|
qs, self.request, match_subevents_with_conditions=Q(active=True) & Q(is_public=True) & date_q
|
||||||
), self.request.sales_channel)
|
), self.request.sales_channel)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
# 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/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
import os
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
import fakeredis
|
import fakeredis
|
||||||
@@ -38,4 +39,9 @@ def mocker_context():
|
|||||||
|
|
||||||
|
|
||||||
def get_redis_connection(alias="default", write=True):
|
def get_redis_connection(alias="default", write=True):
|
||||||
return fakeredis.FakeStrictRedis(server=fakeredis.FakeServer.get_server("127.0.0.1:None:v(7, 0)", (7, 0), server_type="redis"))
|
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"))
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ def test_order_create_invoice(token_client, organizer, event, order):
|
|||||||
"invoice_to_vat_id": "DE123",
|
"invoice_to_vat_id": "DE123",
|
||||||
"invoice_to_beneficiary": "",
|
"invoice_to_beneficiary": "",
|
||||||
"custom_field": None,
|
"custom_field": None,
|
||||||
'date': now().date().isoformat(),
|
'date': now().astimezone(event.timezone).date().isoformat(),
|
||||||
'refers': None,
|
'refers': None,
|
||||||
'locale': 'en',
|
'locale': 'en',
|
||||||
'introductory_text': '',
|
'introductory_text': '',
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import inspect
|
import inspect
|
||||||
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
@@ -82,27 +83,32 @@ def reset_locale():
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fakeredis_client(monkeypatch):
|
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(
|
with override_settings(
|
||||||
HAS_REDIS=True,
|
HAS_REDIS=True,
|
||||||
REAL_CACHE_USED=True,
|
REAL_CACHE_USED=True,
|
||||||
CACHES={
|
CACHES={
|
||||||
'redis': {
|
'redis': {
|
||||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
||||||
'LOCATION': 'redis://127.0.0.1',
|
'LOCATION': f'redis://127.0.0.1:{redis_port}',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'connection_class': FakeConnection
|
'connection_class': FakeConnection
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'redis_session': {
|
'redis_session': {
|
||||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
||||||
'LOCATION': 'redis://127.0.0.1',
|
'LOCATION': f'redis://127.0.0.1:{redis_port}',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'connection_class': FakeConnection
|
'connection_class': FakeConnection
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'default': {
|
'default': {
|
||||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
||||||
'LOCATION': 'redis://127.0.0.1',
|
'LOCATION': f'redis://127.0.0.1:{redis_port}',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'connection_class': FakeConnection
|
'connection_class': FakeConnection
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user