diff --git a/pytest_mergify/__init__.py b/pytest_mergify/__init__.py index 003d1b8..fcf2b42 100644 --- a/pytest_mergify/__init__.py +++ b/pytest_mergify/__init__.py @@ -77,7 +77,7 @@ def pytest_sessionstart(self, session: _pytest.main.Session) -> None: self.session_span = self.tracer.start_span( "pytest session start", attributes={ - "test.type": "session", + "test.scope": "session", }, ) self.has_error = False @@ -108,7 +108,7 @@ def pytest_runtest_protocol( context = opentelemetry.trace.set_span_in_context(self.session_span) with self.tracer.start_as_current_span( item.nodeid, - attributes=self._attributes_from_item(item) | {"test.type": "case"}, + attributes=self._attributes_from_item(item) | {"test.scope": "case"}, context=context, ): yield @@ -148,7 +148,7 @@ def _attributes_from_fixturedef( SpanAttributes.CODE_FUNCTION: fixturedef.argname, SpanAttributes.CODE_LINENO: fixturedef.func.__code__.co_firstlineno, "test.fixture.scope": fixturedef.scope, - "test.type": "fixture", + "test.scope": "fixture", } def _name_from_fixturedef( diff --git a/tests/test_spans.py b/tests/test_spans.py index b190c3d..402f7fe 100644 --- a/tests/test_spans.py +++ b/tests/test_spans.py @@ -23,7 +23,7 @@ def test_session( ) -> None: result, spans = pytester_with_spans() s = spans["pytest session start"] - assert s.attributes == {"test.type": "session"} + assert s.attributes == {"test.scope": "session"} assert s.status.status_code == opentelemetry.trace.StatusCode.OK @@ -32,7 +32,7 @@ def test_session_fail( ) -> None: result, spans = pytester_with_spans("def test_fail(): assert False") s = spans["pytest session start"] - assert s.attributes == {"test.type": "session"} + assert s.attributes == {"test.scope": "session"} assert s.status.status_code == opentelemetry.trace.StatusCode.ERROR @@ -43,7 +43,7 @@ def test_test( session_span = spans["pytest session start"] assert spans["test_test.py::test_pass"].attributes == { - "test.type": "case", + "test.scope": "case", "code.function": "test_pass", "code.lineno": 0, "code.filepath": "test_test.py", @@ -69,7 +69,7 @@ def test_test_failure( assert spans["test_test_failure.py::test_error"].attributes == { "test.case.result.status": "failed", - "test.type": "case", + "test.scope": "case", "code.function": "test_error", "code.lineno": 0, "code.filepath": "test_test_failure.py", @@ -110,7 +110,7 @@ def test_skipped(): assert spans["test_test_skipped.py::test_skipped"].attributes == { "test.case.result.status": "skipped", - "test.type": "case", + "test.scope": "case", "code.function": "test_skipped", "code.lineno": 1, "code.filepath": "test_test_skipped.py", @@ -146,7 +146,7 @@ def test_pass(myfix): pass assert name in spans assert spans["myfix setup"].attributes == { - "test.type": "fixture", + "test.scope": "fixture", "code.function": "myfix", "code.lineno": 2, "code.filepath": anys.ANY_STR, @@ -160,7 +160,7 @@ def test_pass(myfix): pass ) assert spans["myfix teardown"].attributes == { - "test.type": "fixture", + "test.scope": "fixture", "code.function": "myfix", "code.lineno": 2, "code.filepath": anys.ANY_STR, @@ -193,7 +193,7 @@ def test_pass(myfix): pass assert name in spans assert spans["myfix setup"].attributes == { - "test.type": "fixture", + "test.scope": "fixture", "code.function": "myfix", "code.lineno": 2, "code.filepath": anys.ANY_STR, @@ -209,7 +209,7 @@ def test_pass(myfix): pass ) assert spans["myfix teardown"].attributes == { - "test.type": "fixture", + "test.scope": "fixture", "code.function": "myfix", "code.lineno": 2, "code.filepath": anys.ANY_STR, @@ -224,7 +224,7 @@ def test_pass(myfix): pass ) assert spans["test_fixture_failure.py::test_pass"].attributes == { - "test.type": "case", + "test.scope": "case", "code.function": "test_pass", "code.lineno": 3, "code.filepath": "test_fixture_failure.py",