Revert "tests: py: use `os.unshare` Python function"
Phil Sutter
reviewerPATCH 1/1 Revert "tests: py: use `os.unshare` Python function"
This reverts commit c29407ab300f8ed54b5ca27cf4837c0aab920760.
This change breaks 'time' expression tests in py test suite. It looks like with os.unshare, modifications to os.environ are lost. Neither unshare module nor unshare command suffer from this problem.
Fixes c29407ab300f8 ("tests: py: use `os.unshare` Python function")
Suggested-by Jeremy Sowden <[email protected]>
Suggested-by Pablo Neira Ayuso <[email protected]>
Signed-off-by Phil Sutter <[email protected]>
--- tests/py/nft-test.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
tests/py/nft-test.py +1 -8
@@ -1466,14 +1466,7 @@ def set_delete_elements(set_element, set_name, table, filename=None, return [tests, passed, total_warning, total_error, total_unit_run] def spawn_netns(): - # prefer stdlib unshare function ... - try: - os.unshare(os.CLONE_NEWNET) - return True - except Exception as e: - pass - - # ... or unshare module + # prefer unshare module try: import unshare unshare.unshare(unshare.CLONE_NEWNET)
Signature · 1 line
2.51.0
Phil Sutter
reviewerQuoted 10 lines · Phil Sutter
This reverts commit
c29407ab300f8ed54b5ca27cf4837c0aab920760.This change breaks 'time' expression tests in py test suite. It looks like with os.unshare, modifications to os.environ are lost. Neither unshare module nor unshare command suffer from this problem.
Fixes c29407ab300f8 ("tests: py: use `os.unshare` Python function")Suggested-by Jeremy Sowden <[email protected]>Suggested-by Pablo Neira Ayuso <[email protected]>Signed-off-by Phil Sutter <[email protected]>
Patch applied.