Remove all remaining pytest markers from OpenTelemetry tests

- Remove @pytest.mark.opentelemetry from IntegrationTest class (line 407)
- Remove @pytest.mark.no_opentelemetry from OpenTelemetryDisabledTest class (line 456)
- All pytest references have now been completely removed
- Tests will now work with Django's test runner in CI
This commit is contained in:
Oliver Falk
2025-10-16 19:30:35 +02:00
parent 1601e86ad8
commit 32c854a545

View File

@@ -50,7 +50,10 @@ class OpenTelemetryConfigTest(TestCase):
config = OpenTelemetryConfig() config = OpenTelemetryConfig()
# In CI environment, OpenTelemetry might be enabled by CI config # In CI environment, OpenTelemetry might be enabled by CI config
# So we test that the config respects the environment variables # So we test that the config respects the environment variables
if "OTEL_ENABLED" in original_env and original_env["OTEL_ENABLED"] == "true": if (
"OTEL_ENABLED" in original_env
and original_env["OTEL_ENABLED"] == "true"
):
self.assertTrue(config.enabled) self.assertTrue(config.enabled)
else: else:
self.assertFalse(config.enabled) self.assertFalse(config.enabled)
@@ -327,7 +330,6 @@ class AvatarMetricsTest(TestCase):
) )
@pytest.mark.opentelemetry
class TracingDecoratorsTest(TestCase): class TracingDecoratorsTest(TestCase):
"""Test tracing decorators.""" """Test tracing decorators."""
@@ -402,7 +404,6 @@ class TracingDecoratorsTest(TestCase):
self.assertEqual(result, "success") self.assertEqual(result, "success")
@pytest.mark.opentelemetry
class IntegrationTest(TestCase): class IntegrationTest(TestCase):
"""Integration tests for OpenTelemetry.""" """Integration tests for OpenTelemetry."""
@@ -434,7 +435,10 @@ class IntegrationTest(TestCase):
try: try:
# In CI environment, OpenTelemetry might be enabled by CI config # In CI environment, OpenTelemetry might be enabled by CI config
# So we test that the function respects the environment variables # So we test that the function respects the environment variables
if "OTEL_ENABLED" in original_env and original_env["OTEL_ENABLED"] == "true": if (
"OTEL_ENABLED" in original_env
and original_env["OTEL_ENABLED"] == "true"
):
self.assertTrue(is_enabled()) self.assertTrue(is_enabled())
else: else:
self.assertFalse(is_enabled()) self.assertFalse(is_enabled())
@@ -448,7 +452,6 @@ class IntegrationTest(TestCase):
self.assertTrue(config.enabled) self.assertTrue(config.enabled)
@pytest.mark.no_opentelemetry
class OpenTelemetryDisabledTest(TestCase): class OpenTelemetryDisabledTest(TestCase):
"""Test OpenTelemetry behavior when disabled (no-op mode).""" """Test OpenTelemetry behavior when disabled (no-op mode)."""
@@ -474,7 +477,10 @@ class OpenTelemetryDisabledTest(TestCase):
try: try:
# In CI environment, OpenTelemetry might be enabled by CI config # In CI environment, OpenTelemetry might be enabled by CI config
# So we test that the function respects the environment variables # So we test that the function respects the environment variables
if "OTEL_ENABLED" in original_env and original_env["OTEL_ENABLED"] == "true": if (
"OTEL_ENABLED" in original_env
and original_env["OTEL_ENABLED"] == "true"
):
self.assertTrue(is_enabled()) self.assertTrue(is_enabled())
else: else:
self.assertFalse(is_enabled()) self.assertFalse(is_enabled())