Skip to content

Commit f9453b9

Browse files
authored
Fix system metrics unit tests on mac (#3638)
* Fix system metrics unit tests on mac Don't test for system.network.connections on mac * round
1 parent 109173f commit f9453b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def test_system_metrics_instrument(self):
113113
"system.network.packets",
114114
"system.network.errors",
115115
"system.network.io",
116-
"system.network.connections",
117116
"system.thread_count",
118117
"process.context_switches",
119118
"process.cpu.time",
@@ -137,6 +136,8 @@ def test_system_metrics_instrument(self):
137136
observer_names.append(
138137
f"process.runtime.{self.implementation}.gc_count",
139138
)
139+
if sys.platform != "darwin":
140+
observer_names.append("system.network.connections")
140141

141142
self.assertEqual(sorted(metric_names), sorted(observer_names))
142143

@@ -767,6 +768,7 @@ def test_system_network_io(self, mock_net_io_counters):
767768
]
768769
self._test_metrics("system.network.io", expected)
769770

771+
@skipIf(sys.platform == "darwin", "No network connections on macOS")
770772
@mock.patch("psutil.net_connections")
771773
def test_system_network_connections(self, mock_net_connections):
772774
NetConnection = namedtuple(

0 commit comments

Comments
 (0)