Skip to content

Commit

Permalink
Supports mode switching for testing by environment
Browse files Browse the repository at this point in the history
- Switch between test_backend (lighter process) and test_backend_full (heavier process)
  • Loading branch information
tienday committed Aug 8, 2024
1 parent 4d22983 commit 451e99a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ define rm_unused_docker_containers
docker ps -a --filter "status=exited" --filter "name=$(1)" --format "{{.ID}}" | xargs --no-run-if-empty docker rm
endef

PYTEST = poetry run pytest -s

.PHONY: test_run
test_run:
# cleanup
Expand All @@ -17,7 +19,7 @@ test_run:
# build/run
docker compose -f docker-compose.test.yml build test_studio_backend
docker compose -f docker-compose.test.yml build test_studio_frontend
docker compose -f docker-compose.test.yml run test_studio_backend
docker compose -f docker-compose.test.yml run test_studio_backend $(PYTEST) -m "not heavier_processing"
docker compose -f docker-compose.test.yml run test_studio_frontend

.PHONY: test_backend
Expand All @@ -28,7 +30,17 @@ test_backend:
@$(call rm_unused_docker_containers, test_studio_backend)
# build/run
docker compose -f docker-compose.test.yml build test_studio_backend
docker compose -f docker-compose.test.yml run test_studio_backend
docker compose -f docker-compose.test.yml run test_studio_backend $(PYTEST) -m "not heavier_processing"

.PHONY: test_backend_full
test_backend_full:
# cleanup
docker compose -f docker-compose.test.yml down
docker compose -f docker-compose.test.yml rm -f
@$(call rm_unused_docker_containers, test_studio_backend)
# build/run
docker compose -f docker-compose.test.yml build test_studio_backend
docker compose -f docker-compose.test.yml run test_studio_backend $(PYTEST)

.PHONY: test_frontend
test_frontend:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ services:
environment:
PYTHONPATH: .
TZ: Asia/Tokyo
command: bash -c "poetry run python3 -m pytest -s"
volumes:
- .:/app

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ filterwarnings = [
"ignore:invalid escape sequence :DeprecationWarning",
]
markers = [
"snakemake_executor_lccd",
"snakemake_executor_suite2p",
"lighter_processing",
"heavier_processing",
]

[tool.codespell]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
output_dirpath = f"{DIRPATH.OUTPUT_DIR}/{workspace_id}/{unique_id}"


@pytest.mark.snakemake_executor_lccd
@pytest.mark.lighter_processing
def test_snakemake_execute(client):
"""
Test for Run snakemake
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_snakemake_execute(client):
assert os.path.exists(error_log_filepath)


@pytest.mark.snakemake_executor_lccd
@pytest.mark.lighter_processing
def test_snakemake_delete_dependencies():
"""
Test for delete snakemake dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
output_dirpath = f"{DIRPATH.OUTPUT_DIR}/{workspace_id}/{unique_id}"


@pytest.mark.snakemake_executor_suite2p
@pytest.mark.heavier_processing
def test_snakemake_execute(client):
"""
Test for Run snakemake
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_snakemake_execute(client):
assert os.path.exists(error_log_filepath)


@pytest.mark.snakemake_executor_suite2p
@pytest.mark.heavier_processing
def test_snakemake_delete_dependencies():
"""
Test for delete snakemake dependencies
Expand Down

0 comments on commit 451e99a

Please sign in to comment.