Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/core/tests/Test_EnvLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,8 @@ def test_get_package_manager_azure_linux_4_and_rhel10_not_supported(self):
for row in test_input_output_table:
self.envlayer.platform.linux_distribution = row[0]
distro.os_release_attr = row[1]

captured_output = io.StringIO()
sys.stdout = captured_output
result = self.envlayer.get_package_manager()
sys.stdout = sys.__stdout__
Copy link
Copy Markdown
Contributor

@rane-rajasi rane-rajasi May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashnap, I think the problem was this line. See other examples in code where this is already implemented, for eg: test_reset_auto_assessment_log_file_if_needed_raise_exception()

you are setting sys.stdout to captured_output on line 171, but on line 174 while resetting sys.stdout it is set to "sys.__ stdout __ " (adding space because of github formatting). What does sys.__ stdout __ represent? Why not reset it to its original value?

self.assertEqual(row[2], captured_output.getvalue())
self.assertEqual(result, "")
package_manager = self.envlayer.get_package_manager()
self.assertEqual(package_manager, "")
Comment on lines 167 to +171

# restore
self.__restore_mocks()
Expand Down
Loading