Skip to content

Commit 8a33f4a

Browse files
fix: convert _make_span to module-level function to fix pylint R6301
1 parent 3ac4699 commit 8a33f4a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

opentelemetry-instrumentation/tests/test_semconv_status.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@
1616
from opentelemetry.trace.status import Status, StatusCode
1717

1818

19-
class TestSetStatus(unittest.TestCase):
20-
def _make_span(self, status_code, description=None):
21-
span = MagicMock()
22-
span.is_recording.return_value = True
23-
span.status = Status(status_code, description)
24-
return span
19+
def _make_span(status_code, description=None):
20+
span = MagicMock()
21+
span.is_recording.return_value = True
22+
span.status = Status(status_code, description)
23+
return span
24+
2525

26+
class TestSetStatus(unittest.TestCase):
2627
def test_does_not_downgrade_error_to_ok(self):
2728
"""ERROR status should not be overridden by a lower priority OK"""
28-
span = self._make_span(StatusCode.ERROR, "original error")
29+
span = _make_span(StatusCode.ERROR, "original error")
2930
_set_status(
3031
span,
3132
{},
@@ -41,7 +42,7 @@ def test_does_not_downgrade_error_to_ok(self):
4142

4243
def test_does_not_wipe_description_with_none(self):
4344
"""Same ERROR status should preserve existing description"""
44-
span = self._make_span(StatusCode.ERROR, "keep this message")
45+
span = _make_span(StatusCode.ERROR, "keep this message")
4546
_set_status(
4647
span,
4748
{},
@@ -57,7 +58,7 @@ def test_does_not_wipe_description_with_none(self):
5758

5859
def test_upgrades_unset_to_error(self):
5960
"""UNSET status should be upgraded to ERROR"""
60-
span = self._make_span(StatusCode.UNSET)
61+
span = _make_span(StatusCode.UNSET)
6162
_set_status(
6263
span,
6364
{},
@@ -72,7 +73,7 @@ def test_upgrades_unset_to_error(self):
7273

7374
def test_unset_to_ok(self):
7475
"""UNSET status should be upgraded to OK for 2xx"""
75-
span = self._make_span(StatusCode.UNSET)
76+
span = _make_span(StatusCode.UNSET)
7677
_set_status(
7778
span,
7879
{},

0 commit comments

Comments
 (0)