diff --git a/tests/tests_system/test_process.py b/tests/tests_system/test_process.py index 49a9da2a71..3a5ff5da0a 100644 --- a/tests/tests_system/test_process.py +++ b/tests/tests_system/test_process.py @@ -6,7 +6,6 @@ # compatible open source license. import tempfile -import time import unittest from unittest.mock import MagicMock, call, patch @@ -26,16 +25,13 @@ def test(self) -> None: self.assertIsNotNone(process_handler.stderr_data) return_code = process_handler.terminate() - # Adding time of sleep to property terminate process - # Or the return code will be `None` - time.sleep(10) # In Python 3.9 it seems that Process Termination is not as stable in 3.7. # With low hardware specs the result can be None # While on a much beefier server the termination can be instant + # We even observed the same success on CentOS7 but fail on Ubuntu out of nowhere # Adding sleep time is not very efficient and it is very random, thus allow 2 return values here. - # assert return_code in [None, 1] - self.assertEqual(return_code, None) + assert return_code in [None, 1] self.assertIsNotNone(process_handler.stdout_data) self.assertIsNotNone(process_handler.stderr_data)