From 3c9de3d16e16bfe5baec54e72a8efe59326a5493 Mon Sep 17 00:00:00 2001 From: SoulPancake Date: Thu, 11 Dec 2025 11:14:51 +0530 Subject: [PATCH 1/2] chore: mark integration tests --- Makefile | 3 +++ pyproject.toml | 6 +++++- test/error_integration_test.py | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c9361ba..5e1de44 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ sync: test: uv run pytest --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/) +test-integration: + uv run pytest -m integration --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/) + # Run linter lint: uv run ruff check . diff --git a/pyproject.toml b/pyproject.toml index 75fcbf5..1a5b5a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -131,11 +131,15 @@ testpaths = [ "integration", ] -addopts = "--cov=openfga_sdk --cov-report term-missing --cov-report xml --cov-report html" +addopts = "--cov=openfga_sdk --cov-report term-missing --cov-report xml --cov-report html --strict-markers" asyncio_mode = "strict" asyncio_default_fixture_loop_scope = "function" +markers = [ + "integration: marks tests as integration tests requiring a running OpenFGA server", +] + [tool.mypy] python_version = "3.10" packages = "openfga_sdk" diff --git a/test/error_integration_test.py b/test/error_integration_test.py index 99c6b16..585804d 100644 --- a/test/error_integration_test.py +++ b/test/error_integration_test.py @@ -53,7 +53,7 @@ ], } - +@pytest.mark.integration @pytest.mark.asyncio class TestErrorIntegration: """Integration tests for enhanced error handling.""" @@ -424,6 +424,7 @@ async def test_error_details_not_lost_in_traceback(self, fga_client): # Sync version of tests +@pytest.mark.integration class TestErrorIntegrationSync: """Synchronous integration tests for enhanced error handling.""" From 549ceb1a852729fd5de3cd7aca6fcf98ea3e3632 Mon Sep 17 00:00:00 2001 From: SoulPancake Date: Thu, 11 Dec 2025 11:20:05 +0530 Subject: [PATCH 2/2] fix: deselect integration tests in test Makefile command --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5e1de44..d43f484 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ sync: uv sync -# Run tests with coverage +# Run tests with coverage (excludes integration tests) # Usage: make test # To run a specific test: make test TEST=test_file.py::test_function test: - uv run pytest --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/) + uv run pytest -m "not integration" --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/) test-integration: uv run pytest -m integration --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/) @@ -33,7 +33,8 @@ check: lint fmt test doc: @echo "Available targets:" @echo " sync - Install/update dependencies" - @echo " test - Run tests with coverage (use TEST=path.to.test to run specific tests)" + @echo " test - Run tests with coverage (excludes integration tests, use TEST=path.to.test to run specific tests)" + @echo " test-integration - Run integration tests with coverage" @echo " lint - Run linter checks" @echo " fmt - Format code" @echo " fix - Fix fixable linting and formatting issues"