1818# Configuration Variables
1919# ========================
2020
21- PYTEST_ARGS ?= -v # Override with e.g. PYTEST_ARGS="-vv --tb=short"
21+ PYTEST_ARGS ?= -v -x # Override with e.g. PYTEST_ARGS="-vv --tb=short"
2222COVERAGE ?= 0 # Set COVERAGE=1 to enable coverage: make test COVERAGE=1
2323COVERAGE_FAIL_UNDER ?= 85 # Minimum coverage % to pass: make coverage-report COVERAGE_FAIL_UNDER=70
24+ KEEP_COMPOSE ?= 0 # Set KEEP_COMPOSE=1 to keep containers after integration tests
25+
26+ PIP = python -m pip
27+
28+ POETRY_VERSION = 2.1.4
29+ POETRY = python -m poetry
2430
2531ifeq ($(COVERAGE ) ,1)
26- TEST_RUNNER = poetry run coverage run --parallel-mode --source=pyiceberg -m
32+ TEST_RUNNER = $( POETRY ) run coverage run --parallel-mode --source=pyiceberg -m
2733else
28- TEST_RUNNER = poetry run
34+ TEST_RUNNER = $( POETRY ) run
2935endif
3036
31- POETRY_VERSION = 2.1.4
37+ ifeq ($(KEEP_COMPOSE ) ,1)
38+ CLEANUP_COMMAND = echo "Keeping containers running for debugging (KEEP_COMPOSE=1)"
39+ else
40+ CLEANUP_COMMAND = docker compose -f dev/docker-compose-integration.yml down -v --remove-orphans --timeout 0 2>/dev/null || true
41+ endif
3242
3343# ============
3444# Help Section
@@ -46,21 +56,21 @@ help: ## Display this help message
4656# #@ Setup
4757
4858install-poetry : # # Ensure Poetry is installed at the specified version
49- @if ! command -v poetry & > /dev/null; then \
59+ @if ! command -v ${POETRY} & > /dev/null; then \
5060 echo " Poetry not found. Installing..." ; \
51- pip install --user poetry==$(POETRY_VERSION ) ; \
61+ ${PIP} install poetry==$(POETRY_VERSION ) ; \
5262 else \
53- INSTALLED_VERSION=$$(pip show poetry | grep Version | awk '{print $$2}' ) ; \
63+ INSTALLED_VERSION=$$(${PIP} show poetry | grep Version | awk '{print $$2}' ) ; \
5464 if [ " $$ INSTALLED_VERSION" != " $( POETRY_VERSION) " ]; then \
5565 echo " Updating Poetry to version $( POETRY_VERSION) ..." ; \
56- pip install --user --upgrade poetry==$(POETRY_VERSION ) ; \
66+ ${PIP} install --upgrade poetry==$(POETRY_VERSION ) ; \
5767 else \
5868 echo " Poetry version $( POETRY_VERSION) already installed." ; \
5969 fi ; \
6070 fi
6171
6272install-dependencies : # # Install all dependencies including extras
63- poetry install --all-extras
73+ $( POETRY ) install --all-extras
6474
6575install : install-poetry install-dependencies # # Install Poetry and dependencies
6676
@@ -74,7 +84,7 @@ check-license: ## Check license headers
7484 ./dev/check-license
7585
7686lint : # # Run code linters via pre-commit
77- poetry run pre-commit run --all-files
87+ $( POETRY ) run pre-commit run --all-files
7888
7989# ===============
8090# Testing Section
@@ -85,7 +95,7 @@ lint: ## Run code linters via pre-commit
8595test : # # Run all unit tests (excluding integration)
8696 $(TEST_RUNNER ) pytest tests/ -m " (unmarked or parametrize) and not integration" $(PYTEST_ARGS )
8797
88- test-integration : test-integration-setup test-integration-exec # # Run integration tests
98+ test-integration : test-integration-setup test-integration-exec test-integration-cleanup # # Run integration tests
8999
90100test-integration-setup : # # Start Docker services for integration tests
91101 docker compose -f dev/docker-compose-integration.yml kill
@@ -98,6 +108,12 @@ test-integration-setup: ## Start Docker services for integration tests
98108test-integration-exec : # # Run integration tests (excluding provision)
99109 $(TEST_RUNNER ) pytest tests/ -m integration $(PYTEST_ARGS )
100110
111+ test-integration-cleanup : # # Clean up integration test environment
112+ @if [ " ${KEEP_COMPOSE} " != " 1" ]; then \
113+ echo " Cleaning up Docker containers..." ; \
114+ fi
115+ $(CLEANUP_COMMAND )
116+
101117test-integration-rebuild : # # Rebuild integration Docker services from scratch
102118 docker compose -f dev/docker-compose-integration.yml kill
103119 docker compose -f dev/docker-compose-integration.yml rm -f
@@ -119,10 +135,10 @@ test-coverage: COVERAGE=1
119135test-coverage : test test-integration test-s3 test-adls test-gcs coverage-report # # Run all tests with coverage and report
120136
121137coverage-report : # # Combine and report coverage
122- poetry run coverage combine
123- poetry run coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER )
124- poetry run coverage html
125- poetry run coverage xml
138+ ${POETRY} run coverage combine
139+ ${POETRY} run coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER )
140+ ${POETRY} run coverage html
141+ ${POETRY} run coverage xml
126142
127143# ================
128144# Documentation
@@ -131,13 +147,13 @@ coverage-report: ## Combine and report coverage
131147# #@ Documentation
132148
133149docs-install : # # Install docs dependencies
134- poetry install --with docs
150+ ${POETRY} install --with docs
135151
136152docs-serve : # # Serve local docs preview (hot reload)
137- poetry run mkdocs serve -f mkdocs/mkdocs.yml
153+ ${POETRY} run mkdocs serve -f mkdocs/mkdocs.yml
138154
139155docs-build : # # Build the static documentation site
140- poetry run mkdocs build -f mkdocs/mkdocs.yml --strict
156+ ${POETRY} run mkdocs build -f mkdocs/mkdocs.yml --strict
141157
142158# ===================
143159# Project Maintenance
0 commit comments