Skip to content

Commit

Permalink
Fix api tests for real
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed Jan 17, 2025
1 parent c595be1 commit 103f285
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions opentelemetry-api/tests/metrics/test_meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TestMeter(TestCase):
# TODO: convert to assertNoLogs instead of mocking logger when 3.10 is baseline
@patch("opentelemetry.metrics._internal._logger")
def test_repeated_instrument_names(self, logger_mock):
with self.assertNotRaises(Exception):
try:
test_meter = NoOpMeter("name")

test_meter.create_counter("counter")
Expand All @@ -97,6 +97,8 @@ def test_repeated_instrument_names(self, logger_mock):
test_meter.create_observable_up_down_counter(
"observable_up_down_counter", Mock()
)
except Exception as error: # pylint: disable=broad-exception-caught
self.fail(f"Unexpected exception raised {error}")

for instrument_name in [
"counter",
Expand All @@ -118,7 +120,7 @@ def test_repeated_instrument_names(self, logger_mock):
logger_mock.warning.assert_not_called()

def test_repeated_instrument_names_with_different_advisory(self):
with self.assertNotRaises(Exception):
try:
test_meter = NoOpMeter("name")

test_meter.create_counter("counter")
Expand All @@ -130,6 +132,8 @@ def test_repeated_instrument_names_with_different_advisory(self):
test_meter.create_observable_up_down_counter(
"observable_up_down_counter", Mock()
)
except Exception as error: # pylint: disable=broad-exception-caught
self.fail(f"Unexpected exception raised {error}")

for instrument_name in [
"counter",
Expand Down

0 comments on commit 103f285

Please sign in to comment.