From 1333b0b3c3de690f1b652c3b03d0802b63f8a5e8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 31 Jul 2021 21:42:37 -0700 Subject: [PATCH 1/3] Simplifies env for django tests --- .github/workflows/django-tests.yml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml index c11b7c408..9a801dd75 100644 --- a/.github/workflows/django-tests.yml +++ b/.github/workflows/django-tests.yml @@ -9,18 +9,9 @@ jobs: build: runs-on: ubuntu-20.04 - strategy: - max-parallel: 4 - matrix: - db: [postgres] - python-version: [3.9] - include: - - db: postgres - db_port: 5432 - services: postgres: - image: postgres:12 + image: postgres:13 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: hunter2 @@ -33,20 +24,16 @@ jobs: - 5432:5432 steps: - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: 3.9 - name: Install Dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run Tests env: - DB: ${{ matrix.db }} - DB_HOST: 127.0.0.1 - DB_PORT: ${{ matrix.db_port }} - DB_PASSWORD: hunter2 SECRET_KEY: beepbeep DEBUG: true DOMAIN: your.domain.here From 8d476804c2041e526524265309eefa8390a87aeb Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 1 Aug 2021 07:38:16 -0700 Subject: [PATCH 2/3] Potential speedups --- .github/workflows/django-tests.yml | 4 ++-- bookwyrm/test_settings.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 bookwyrm/test_settings.py diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml index 9a801dd75..8ee1cea52 100644 --- a/.github/workflows/django-tests.yml +++ b/.github/workflows/django-tests.yml @@ -35,7 +35,7 @@ jobs: - name: Run Tests env: SECRET_KEY: beepbeep - DEBUG: true + DEBUG: false DOMAIN: your.domain.here BOOKWYRM_DATABASE_BACKEND: postgres MEDIA_ROOT: images/ @@ -53,4 +53,4 @@ jobs: EMAIL_USE_TLS: true ENABLE_PREVIEW_IMAGES: true run: | - pytest + pytest --reuse-db diff --git a/bookwyrm/test_settings.py b/bookwyrm/test_settings.py new file mode 100644 index 000000000..5dc34c97b --- /dev/null +++ b/bookwyrm/test_settings.py @@ -0,0 +1,14 @@ +""" bookwyrm settings and configuration """ +from bookwyrm.settings import * + +MIGRATION_MODULES = { + 'auth': None, + 'contenttypes': None, + 'default': None, + 'sessions': None, + + 'core': None, + 'profiles': None, + 'snippets': None, + 'scaffold_templates': None, +} From 1791b5b9fa2ac263b0d57f080adbc9e9fc69013e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 2 Aug 2021 12:34:18 -0700 Subject: [PATCH 3/3] Try running tests in parellel --- .github/workflows/django-tests.yml | 2 +- bookwyrm/test_settings.py | 14 -------------- requirements.txt | 1 + 3 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 bookwyrm/test_settings.py diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml index 8ee1cea52..850a4be32 100644 --- a/.github/workflows/django-tests.yml +++ b/.github/workflows/django-tests.yml @@ -53,4 +53,4 @@ jobs: EMAIL_USE_TLS: true ENABLE_PREVIEW_IMAGES: true run: | - pytest --reuse-db + pytest -n 3 diff --git a/bookwyrm/test_settings.py b/bookwyrm/test_settings.py deleted file mode 100644 index 5dc34c97b..000000000 --- a/bookwyrm/test_settings.py +++ /dev/null @@ -1,14 +0,0 @@ -""" bookwyrm settings and configuration """ -from bookwyrm.settings import * - -MIGRATION_MODULES = { - 'auth': None, - 'contenttypes': None, - 'default': None, - 'sessions': None, - - 'core': None, - 'profiles': None, - 'snippets': None, - 'scaffold_templates': None, -} diff --git a/requirements.txt b/requirements.txt index 6d29982e9..85145a4db 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,3 +21,4 @@ coverage==5.1 pytest-django==4.1.0 pytest==6.1.2 pytest-cov==2.10.1 +pytest-xdist==2.3.0