From 18edf4073c2ac4691ad0ab8c8e6bb5ff3ef4d810 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Fri, 21 Oct 2022 10:39:02 -0400 Subject: [PATCH] Add DANDI_TESTS_PULL_DOCKER_COMPOSE envvar --- DEVELOPMENT.md | 4 ++++ dandi/tests/fixtures.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 0f24453f7..46694fff7 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -74,6 +74,10 @@ development command line options. new set on each run. Set this environment variable to `0` to cause the containers to be destroyed at the end of the next run. +- `DANDI_TESTS_PULL_DOCKER_COMPOSE` -- When set to an empty string or `0`, the + tests will not pull the latest needed Docker images at the start of a run if + older versions of the images are already present. + ## Sourcegraph The [Sourcegraph](https://sourcegraph.com) browser extension can be used to diff --git a/dandi/tests/fixtures.py b/dandi/tests/fixtures.py index 92c5d02dd..811df11dc 100644 --- a/dandi/tests/fixtures.py +++ b/dandi/tests/fixtures.py @@ -253,7 +253,8 @@ def docker_compose_setup() -> Iterator[Dict[str, str]]: env = {**os.environ, "DJANGO_DANDI_SCHEMA_VERSION": DANDI_SCHEMA_VERSION} try: if create: - run(["docker-compose", "pull"], cwd=str(LOCAL_DOCKER_DIR), check=True) + if os.environ.get("DANDI_TESTS_PULL_DOCKER_COMPOSE", "1") not in ("", "0"): + run(["docker-compose", "pull"], cwd=str(LOCAL_DOCKER_DIR), check=True) run( ["docker-compose", "run", "--rm", "django", "./manage.py", "migrate"], cwd=str(LOCAL_DOCKER_DIR),