diff --git a/.github/workflows/python-integration.yml b/.github/workflows/python-integration.yml index ce04f4bc93..982820595a 100644 --- a/.github/workflows/python-integration.yml +++ b/.github/workflows/python-integration.yml @@ -45,10 +45,6 @@ jobs: uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos - - name: Install - run: make install - name: Run integration tests with coverage run: COVERAGE=1 make test-integration - name: Show debug logs @@ -75,10 +71,6 @@ jobs: uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos - - name: Install - run: make install - name: Run s3 integration tests with coverage run: COVERAGE=1 make test-s3 - name: Show debug logs @@ -105,10 +97,6 @@ jobs: uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos - - name: Install - run: make install - name: Run adls integration tests with coverage run: COVERAGE=1 make test-adls - name: Show debug logs @@ -135,10 +123,6 @@ jobs: uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos - - name: Install - run: make install - name: Run gcs integration tests with coverage run: COVERAGE=1 make test-gcs - name: Show debug logs @@ -165,8 +149,6 @@ jobs: uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 with: enable-cache: true - - name: Install dependencies - run: uv sync --group dev - name: Download all coverage artifacts uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: diff --git a/Makefile b/Makefile index 22e01972da..0ff2c9a8f9 100644 --- a/Makefile +++ b/Makefile @@ -39,10 +39,11 @@ else endif ifeq ($(COVERAGE),1) - TEST_RUNNER = uv run $(PYTHON_ARG) python -m coverage run --parallel-mode --source=pyiceberg -m + TEST_CMD = python -m coverage run --parallel-mode --source=pyiceberg -m else - TEST_RUNNER = uv run $(PYTHON_ARG) python -m + TEST_CMD = python -m endif +TEST_RUNNER = uv run $(PYTHON_ARG) $(TEST_CMD) ifeq ($(KEEP_COMPOSE),1) CLEANUP_COMMAND = echo "Keeping containers running for debugging (KEEP_COMPOSE=1)" @@ -111,14 +112,15 @@ test: ## Run all unit tests (excluding integration) test-integration: test-integration-setup test-integration-exec test-integration-cleanup ## Run integration tests -test-integration-setup: install ## Start Docker services for integration tests +test-integration-setup: ## Start Docker services for integration tests + uv sync $(PYTHON_ARG) --inexact --all-extras --no-extra hive-kerberos docker compose -f dev/docker-compose-integration.yml kill docker compose -f dev/docker-compose-integration.yml rm -f docker compose -f dev/docker-compose-integration.yml up -d --build --wait - uv run $(PYTHON_ARG) python dev/provision.py + uv run $(PYTHON_ARG) --all-extras --no-extra hive-kerberos python dev/provision.py test-integration-exec: ## Run integration tests (excluding provision) - $(TEST_RUNNER) pytest tests/ -m integration $(PYTEST_ARGS) + uv run $(PYTHON_ARG) --all-extras --no-extra hive-kerberos $(TEST_CMD) pytest tests/ -m integration $(PYTEST_ARGS) test-integration-cleanup: ## Clean up integration test environment @if [ "${KEEP_COMPOSE}" != "1" ]; then \ @@ -131,32 +133,32 @@ test-integration-rebuild: ## Rebuild integration Docker services from scratch docker compose -f dev/docker-compose-integration.yml rm -f docker compose -f dev/docker-compose-integration.yml build --no-cache -test-s3: ## Run tests marked with @pytest.mark.s3 +test-s3: ## Run tests in tests/io/ marked with @pytest.mark.s3 sh ./dev/run-s3.sh - $(TEST_RUNNER) pytest tests/ -m s3 $(PYTEST_ARGS) + uv run $(PYTHON_ARG) --extra s3fs --extra pyarrow $(TEST_CMD) pytest tests/io/ -m s3 $(PYTEST_ARGS) -test-adls: ## Run tests marked with @pytest.mark.adls +test-adls: ## Run tests in tests/io/ marked with @pytest.mark.adls sh ./dev/run-azurite.sh - $(TEST_RUNNER) pytest tests/ -m adls $(PYTEST_ARGS) + uv run $(PYTHON_ARG) --extra adlfs --extra pyarrow $(TEST_CMD) pytest tests/io/ -m adls $(PYTEST_ARGS) -test-gcs: ## Run tests marked with @pytest.mark.gcs +test-gcs: ## Run tests in tests/io/ marked with @pytest.mark.gcs sh ./dev/run-gcs-server.sh # gcsfs 2026.6.0 sends HNS/Zonal bucket detection to endpoint_url. # fake-gcs-server does not support that API, so repeated detection retries # make GCS sanity tests take close to an hour. Disable it here. # Workaround documented by gcsfs: # https://github.com/fsspec/gcsfs/blob/2026.6.0/docs/source/hns_buckets.rst#L99-L101 - GCSFS_EXPERIMENTAL_ZB_HNS_SUPPORT=false $(TEST_RUNNER) pytest tests/ -m gcs $(PYTEST_ARGS) + GCSFS_EXPERIMENTAL_ZB_HNS_SUPPORT=false uv run $(PYTHON_ARG) --extra gcsfs --extra pyarrow $(TEST_CMD) pytest tests/io/ -m gcs $(PYTEST_ARGS) test-coverage: ## Run all tests with coverage and report $(MAKE) COVERAGE=1 test test-integration test-s3 test-adls test-gcs $(MAKE) coverage-report coverage-report: ## Combine and report coverage - uv run $(PYTHON_ARG) coverage combine - uv run $(PYTHON_ARG) coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER) - uv run $(PYTHON_ARG) coverage html - uv run $(PYTHON_ARG) coverage xml + uv run $(PYTHON_ARG) --only-group coverage coverage combine + uv run $(PYTHON_ARG) --only-group coverage coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER) + uv run $(PYTHON_ARG) --only-group coverage coverage html + uv run $(PYTHON_ARG) --only-group coverage coverage xml test-notebook: ## Run notebook tests (pyiceberg_example and spark_integration_example) via papermill $(TEST_RUNNER) pytest tests/notebooks/test_pyiceberg_example.py tests/notebooks/test_spark_integration_example.py -m notebook $(PYTEST_ARGS) diff --git a/pyproject.toml b/pyproject.toml index edc0942ab2..7d105aa286 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,7 @@ dev = [ "prek>=0.2.1", "pytest-lazy-fixtures==1.4.1", "fastavro==1.13.1", - "coverage[toml]>=7.4.2", + {include-group = "coverage"}, "requests-mock==1.12.1", "moto[server]>=5.0.2", "typing-extensions==4.16.0", @@ -127,6 +127,7 @@ dev = [ "ty==1.0.0", "datafusion>=53", ] +coverage = ["coverage[toml]>=7.4.2"] # for mkdocs docs = [ "mkdocs==1.6.1", diff --git a/uv.lock b/uv.lock index 3472f2585c..27b1c7dcff 100644 --- a/uv.lock +++ b/uv.lock @@ -506,8 +506,8 @@ resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ - { name = "soupsieve" }, - { name = "typing-extensions" }, + { name = "soupsieve", marker = "python_full_version >= '3.11.5'" }, + { name = "typing-extensions", marker = "python_full_version >= '3.11.5'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/43/65/318323f98dbee45d42dff61d8f047181bc6f2268a9068cfad035a46be5af/beautifulsoup4-4.15.0.tar.gz", hash = "sha256:288e3ca7d54b06f2ac191970bc275c1939cb46d450b255bf6718b04aa37ab4f7", size = 632571, upload-time = "2026-06-07T16:44:20.453Z" } wheels = [ @@ -4538,6 +4538,9 @@ sql-sqlite = [ ] [package.dev-dependencies] +coverage = [ + { name = "coverage", extra = ["toml"] }, +] dev = [ { name = "coverage", extra = ["toml"] }, { name = "cython" }, @@ -4633,6 +4636,7 @@ requires-dist = [ provides-extras = ["pyarrow", "pandas", "duckdb", "ray", "bodo", "daft", "polars", "snappy", "hive", "hive-kerberos", "s3fs", "glue", "adlfs", "dynamodb", "bigquery", "sql-postgres", "sql-sqlite", "gcsfs", "rest-sigv4", "hf", "pyiceberg-core", "gcp-auth", "entra-auth", "geoarrow", "encryption"] [package.metadata.requires-dev] +coverage = [{ name = "coverage", extras = ["toml"], specifier = ">=7.4.2" }] dev = [ { name = "coverage", extras = ["toml"], specifier = ">=7.4.2" }, { name = "cython", specifier = ">=3.0.0" },