Skip to content

Commit 23819d9

Browse files
committed
fix: remove logging to std out during import
Related-To: NEO-18404 Signed-off-by: shubham kumar <shubham.kumar@intel.com>
1 parent 9ebdb41 commit 23819d9

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

bindings/sysman/python/source/pyzes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _LoadZeLibrary():
9595
gpuLib = CDLL(match_path)
9696
library_loaded = True
9797
break
98-
except Exception as e:
98+
except Exception:
9999
continue
100100
else:
101101
if os.path.exists(path):
@@ -106,7 +106,7 @@ def _LoadZeLibrary():
106106
gpuLib = CDLL(path)
107107
library_loaded = True
108108
break
109-
except Exception as e:
109+
except Exception:
110110
continue
111111

112112
if library_loaded:

bindings/sysman/python/test/unit_tests/test_init.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,9 @@ def test_GivenLibraryAlreadyLoadedWhenCallingLoadZeLibraryThenReturnsEarly(self)
118118

119119
try:
120120
# This should return early without any library loading
121-
with patch("builtins.print") as mock_print:
122-
self.pyzes._LoadZeLibrary()
123-
# Should not print "Loading Linux library" because it returns early
124-
print_calls = [
125-
call.args[0] for call in mock_print.call_args_list if call.args
126-
]
127-
self.assertNotIn("Loading Linux library", print_calls)
121+
self.pyzes._LoadZeLibrary()
122+
# Verify gpuLib remains unchanged (early return)
123+
self.assertEqual(self.pyzes.gpuLib, mock_lib)
128124
finally:
129125
# Restore original state
130126
self.pyzes.gpuLib = original_gpuLib
@@ -201,11 +197,10 @@ def test_GivenValidLibraryWhenGettingNewFunctionPointerThenCachesAndReturnsFunct
201197

202198
@patch("sys.platform", "win32")
203199
@patch("pyzes.gpuLib", None)
204-
@patch("builtins.print")
205200
@patch("os.path.exists")
206201
@patch("pyzes.CDLL")
207202
def test_GivenWindowsPlatformWhenLoadingLibraryThenLibraryIsLoaded(
208-
self, mock_cdll, mock_exists, mock_print
203+
self, mock_cdll, mock_exists
209204
):
210205
# Test Windows library loading path with deterministic mocking
211206
mock_exists.return_value = True
@@ -214,10 +209,9 @@ def test_GivenWindowsPlatformWhenLoadingLibraryThenLibraryIsLoaded(
214209

215210
self.pyzes._LoadZeLibrary()
216211

217-
# Verify Windows-specific print was called
218-
mock_print.assert_any_call("Loading Windows library")
219212
# Verify successful library loading
220213
mock_cdll.assert_called()
214+
self.assertIsNotNone(self.pyzes.gpuLib)
221215

222216

223217
if __name__ == "__main__":

0 commit comments

Comments
 (0)