Skip to content

Commit

Permalink
Run the tests in a random order (#1431)
Browse files Browse the repository at this point in the history
* Adds pytest randomly
* Removes caching from the retina views
  • Loading branch information
jmsmkn committed Jul 8, 2020
1 parent add8341 commit 604ee79
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 34 deletions.
1 change: 0 additions & 1 deletion app/config/settings.py
Expand Up @@ -855,7 +855,6 @@ def strtobool(val) -> bool:
RETINA_DEFAULT_THUMBNAIL_SIZE = 128

# Retina specific settings
RETINA_IMAGE_CACHE_TIME = 60 * 60 * 24 * 7
RETINA_GRADERS_GROUP_NAME = "retina_graders"
RETINA_ADMINS_GROUP_NAME = "retina_admins"
RETINA_IMPORT_USER_NAME = "retina_import_user"
Expand Down
22 changes: 5 additions & 17 deletions app/grandchallenge/retina_api/urls.py
@@ -1,6 +1,4 @@
from django.conf import settings
from django.urls import include, path
from django.views.decorators.cache import cache_page
from rest_framework.routers import SimpleRouter

from grandchallenge.retina_api import views
Expand Down Expand Up @@ -47,23 +45,17 @@
path("archives/", views.ArchiveView.as_view(), name="archives-api-view"),
path(
"archive_data/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(
views.ArchiveAPIView.as_view()
),
views.ArchiveAPIView.as_view(),
name="archive-data-api-view",
),
path(
"archive_data/<uuid:pk>/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(
views.ArchiveAPIView.as_view()
),
views.ArchiveAPIView.as_view(),
name="archive-data-api-view",
),
path(
"image/<str:image_type>/<str:patient_identifier>/<str:study_identifier>/<str:image_identifier>/<str:image_modality>/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(
views.ImageView.as_view()
),
views.ImageView.as_view(),
name="image-api-view",
),
path(
Expand Down Expand Up @@ -99,16 +91,12 @@
path("annotation/<int:user_id>/", include(annotation_router.urls)),
path(
"image/thumbnail/<uuid:pk>/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(
views.B64ThumbnailAPIView.as_view()
),
views.B64ThumbnailAPIView.as_view(),
name="image-thumbnail",
),
path(
"image/thumbnail/<uuid:pk>/<int:width>/<int:height>/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(
views.B64ThumbnailAPIView.as_view()
),
views.B64ThumbnailAPIView.as_view(),
name="image-thumbnail",
),
]
6 changes: 2 additions & 4 deletions app/grandchallenge/retina_core/urls.py
@@ -1,6 +1,4 @@
from django.conf import settings
from django.urls import include, path
from django.views.decorators.cache import cache_page

from grandchallenge.retina_core.views import (
IndexView,
Expand All @@ -18,12 +16,12 @@
),
path(
"image/thumbnail/<uuid:image_id>/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(ThumbnailView.as_view()),
ThumbnailView.as_view(),
name="image-thumbnail",
),
path(
"image/numpy/<uuid:image_id>/",
cache_page(settings.RETINA_IMAGE_CACHE_TIME)(NumpyView.as_view()),
NumpyView.as_view(),
name="image-numpy",
),
]
3 changes: 2 additions & 1 deletion app/pytest.ini
Expand Up @@ -2,7 +2,8 @@
DJANGO_SETTINGS_MODULE = tests.settings
testpaths = tests
python_files = tests.py test_*.py *_tests.py
addopts = --strict --showlocals -p no:cacheprovider -n auto --dist loadscope
addopts = --strict --showlocals -n auto --dist loadscope
cache_dir = /tmp/pytest_cache
markers =
integration: integration tests
filterwarnings =
Expand Down
15 changes: 5 additions & 10 deletions docker-compose.yml
Expand Up @@ -115,11 +115,6 @@ services:
target: /var/run/docker.sock
group_add:
- ${DOCKER_GID-999} # The docker group is only needed for testing
healthcheck:
test: ["CMD-SHELL", "curl http://web:8000/ || exit 1"]
interval: 10s
timeout: 5s
retries: 5

http:
image: grandchallenge/http:latest
Expand All @@ -139,7 +134,7 @@ services:
- "443:443"
depends_on:
web:
condition: service_healthy
condition: service_started
workstation-proxy:
condition: service_started

Expand Down Expand Up @@ -167,7 +162,7 @@ services:
hostname: "celery-worker"
depends_on:
web:
condition: service_healthy
condition: service_started
postgres:
condition: service_healthy
redis:
Expand All @@ -191,7 +186,7 @@ services:
hostname: "celery-worker-evaluation"
depends_on:
web:
condition: service_healthy
condition: service_started
postgres:
condition: service_healthy
redis:
Expand Down Expand Up @@ -221,7 +216,7 @@ services:
hostname: "celery-worker-gpu"
depends_on:
web:
condition: service_healthy
condition: service_started
postgres:
condition: service_healthy
redis:
Expand All @@ -248,7 +243,7 @@ services:
"
depends_on:
web:
condition: service_healthy
condition: service_started
postgres:
condition: service_healthy
redis:
Expand Down
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -85,3 +85,4 @@ sphinx-autodoc-typehints = "*"
werkzeug = "*"
sphinx-rtd-theme = "*"
sphinxcontrib-plantuml = "*"
pytest-randomly = "*"

0 comments on commit 604ee79

Please sign in to comment.