diff --git a/Makefile b/Makefile index c9361ba..d43f484 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,14 @@ 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/) # Run linter lint: @@ -30,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" 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."""