diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2967752d9..6e6f4c4f9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,15 +31,21 @@ jobs: python-version: "3.9" - database: sqlite 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: - 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 }} uses: actions/setup-python@v5 with: @@ -74,7 +80,7 @@ jobs: - name: Run concurrency tests 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/ci_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reruns 0 --reuse-db if: matrix.database == 'postgres' - name: Upload coverage uses: codecov/codecov-action@v1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a9d4ef9f5..487eec308 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ tests: - cd src - python manage.py check - make all compress - - PRETIX_CONFIG_FILE=tests/travis_sqlite.cfg py.test --reruns 3 -n 3 tests --maxfail=100 + - PRETIX_CONFIG_FILE=tests/ci_sqlite.cfg py.test --reruns 3 -n 3 tests --maxfail=100 except: - pypi pypi: diff --git a/src/pretix/testutils/settings.py b/src/pretix/testutils/settings.py index daeb557ec..9c5bf7145 100644 --- a/src/pretix/testutils/settings.py +++ b/src/pretix/testutils/settings.py @@ -95,5 +95,5 @@ class DisableMigrations(object): return None -if not os.environ.get("TRAVIS", "") and not os.environ.get("GITHUB_WORKFLOW", ""): +if not os.environ.get("GITHUB_WORKFLOW", ""): MIGRATION_MODULES = DisableMigrations() diff --git a/src/tests/travis_postgres.cfg b/src/tests/ci_postgres.cfg similarity index 100% rename from src/tests/travis_postgres.cfg rename to src/tests/ci_postgres.cfg diff --git a/src/tests/travis_sqlite.cfg b/src/tests/ci_sqlite.cfg similarity index 100% rename from src/tests/travis_sqlite.cfg rename to src/tests/ci_sqlite.cfg diff --git a/src/tests/conftest.py b/src/tests/conftest.py index 051bf0ad5..6ee6911dc 100644 --- a/src/tests/conftest.py +++ b/src/tests/conftest.py @@ -39,8 +39,8 @@ CRASHED_ITEMS = set() @pytest.hookimpl(trylast=True) def pytest_configure(config): """ - 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 + 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 tests and keep fingers crossed that this doesn't turn into an infinite loop. """ diff --git a/src/tests/test_crashing.py b/src/tests/test_crashing.py index c199f0a91..a6db06e44 100644 --- a/src/tests/test_crashing.py +++ b/src/tests/test_crashing.py @@ -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 Travis CI using SQLite. Usually, this test is + to deal with random test crashes on CI using SQLite. Usually, this test is skipped to avoid causing additional crashes in real runs. """ if os.path.exists('crashed.tmp'):