diff --git a/.cursorrules b/.cursorrules index 298508e..e7ec241 100644 --- a/.cursorrules +++ b/.cursorrules @@ -49,7 +49,7 @@ ivatar is a Django-based federated avatar service that serves as an alternative ### Testing - **MANDATORY: Run pre-commit hooks and tests before any changes** - this is an obligation - Use `./run_tests_local.sh` for local development (skips Bluesky tests requiring API credentials) -- Run `python3 manage.py test -v2` for full test suite including Bluesky tests +- Run `python3 manage.py test -v3` for full test suite including Bluesky tests - **MANDATORY: When adding new code, always write tests to increase code coverage** - never decrease coverage - Use pytest markers appropriately: - `@pytest.mark.bluesky`: Tests requiring Bluesky API credentials diff --git a/README.md b/README.md index 7fbc291..755b644 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ ## Running Tests ### Local Development (Recommended) + For local development, use the provided script to skip Bluesky tests that require external API credentials: ```bash @@ -24,27 +25,30 @@ For local development, use the provided script to skip Bluesky tests that requir This runs all tests except those marked with `@pytest.mark.bluesky`. ### All Tests + To run all tests including Bluesky tests (requires Bluesky API credentials): ```bash -python3 manage.py test -v2 +python3 manage.py test -v3 ``` ### Specific Test Categories + ```bash # Run only Bluesky tests -python3 manage.py test ivatar.ivataraccount.test_views_bluesky -v2 +python3 manage.py test ivatar.ivataraccount.test_views_bluesky -v3 # Run only file upload security tests -python3 manage.py test ivatar.test_file_security -v2 +python3 manage.py test ivatar.test_file_security -v3 # Run only upload tests -python3 manage.py test ivatar.ivataraccount.test_views -v2 +python3 manage.py test ivatar.ivataraccount.test_views -v3 ``` ## Test Markers Tests are categorized using pytest markers: + - `@pytest.mark.bluesky`: Tests requiring Bluesky API credentials - `@pytest.mark.slow`: Long-running tests - `@pytest.mark.integration`: Integration tests diff --git a/scripts/run_tests_local.sh b/scripts/run_tests_local.sh index f662bfe..25fb697 100755 --- a/scripts/run_tests_local.sh +++ b/scripts/run_tests_local.sh @@ -21,14 +21,14 @@ python3 manage.py test \ ivatar.test_views_stats \ ivatar.tools.test_views \ ivatar.test_wsgi \ - -v2 + -v3 echo "" echo "To run all tests including Bluesky (requires API credentials):" -echo "python3 manage.py test -v2" +echo "python3 manage.py test -v3" echo "" echo "To run only Bluesky tests:" -echo "python3 manage.py test ivatar.ivataraccount.test_views_bluesky -v2" +echo "python3 manage.py test ivatar.ivataraccount.test_views_bluesky -v3" echo "" echo "To run tests with OpenTelemetry enabled:" echo "./run_tests_with_ot.sh" diff --git a/scripts/run_tests_no_ot.sh b/scripts/run_tests_no_ot.sh index 3447c52..a1b8a96 100755 --- a/scripts/run_tests_no_ot.sh +++ b/scripts/run_tests_no_ot.sh @@ -12,7 +12,7 @@ export ENABLE_OPENTELEMETRY=false export OTEL_ENABLED=false # Run Django tests (Django will auto-discover all tests) -python3 manage.py test -v2 +python3 manage.py test -v3 echo "" echo "Tests completed successfully (OpenTelemetry disabled)" diff --git a/scripts/run_tests_with_ot.sh b/scripts/run_tests_with_ot.sh index a428c72..38d0160 100755 --- a/scripts/run_tests_with_ot.sh +++ b/scripts/run_tests_with_ot.sh @@ -14,7 +14,7 @@ export OTEL_SERVICE_NAME=ivatar-test export OTEL_ENVIRONMENT=test # Run Django tests (Django will auto-discover all tests) -python3 manage.py test -v2 +python3 manage.py test -v3 echo "" echo "Tests completed successfully (OpenTelemetry enabled)"