Skip to content

Commit

Permalink
Add more
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon committed Jun 22, 2023
1 parent 4071e35 commit e67c7c0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tests/tests_system/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# compatible open source license.

import tempfile
import time
import unittest
from unittest.mock import MagicMock, call, patch

Expand All @@ -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)

Expand Down

0 comments on commit e67c7c0

Please sign in to comment.