summaryrefslogtreecommitdiffhomepage
path: root/test/test_java_isolation_rootfs.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2021-11-15 12:13:54 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2021-11-15 12:13:54 +0000
commitae035852385032cc6c502c0e560fc682cacdbf34 (patch)
tree1f2ce0debba13e7cf2589a432638c65c38bc607d /test/test_java_isolation_rootfs.py
parent28eaf9d37842a5d79d8081cc14fbf4cc7e7d49a5 (diff)
downloadunit-ae035852385032cc6c502c0e560fc682cacdbf34.tar.gz
unit-ae035852385032cc6c502c0e560fc682cacdbf34.tar.bz2
Tests: refactored working with processes.
Diffstat (limited to 'test/test_java_isolation_rootfs.py')
-rw-r--r--test/test_java_isolation_rootfs.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/test/test_java_isolation_rootfs.py b/test/test_java_isolation_rootfs.py
index 91773981..eac86a0c 100644
--- a/test/test_java_isolation_rootfs.py
+++ b/test/test_java_isolation_rootfs.py
@@ -18,7 +18,7 @@ class TestJavaIsolationRootfs(TestApplicationJava):
os.chmod(option.temp_dir + '/tmp', 0o777)
try:
- process = subprocess.Popen(
+ subprocess.run(
[
"mount",
"--bind",
@@ -28,12 +28,10 @@ class TestJavaIsolationRootfs(TestApplicationJava):
stderr=subprocess.STDOUT,
)
- process.communicate()
-
except KeyboardInterrupt:
raise
- except:
+ except subprocess.CalledProcessError:
pytest.fail('Can\'t run mount process.')
def teardown_method(self, is_su):
@@ -41,18 +39,16 @@ class TestJavaIsolationRootfs(TestApplicationJava):
return
try:
- process = subprocess.Popen(
+ subprocess.run(
["umount", "--lazy", option.temp_dir + "/jars"],
stderr=subprocess.STDOUT,
)
- process.communicate()
-
except KeyboardInterrupt:
raise
- except:
- pytest.fail('Can\'t run mount process.')
+ except subprocess.CalledProcessError:
+ pytest.fail('Can\'t run umount process.')
def test_java_isolation_rootfs_chroot_war(self, is_su, temp_dir):
if not is_su: