From 39adb292d54403d17f86f6852e87b0bda1d49946 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 18 Oct 2021 01:10:11 +0100 Subject: Tests: style. --- test/test_java_isolation_rootfs.py | 1 - 1 file changed, 1 deletion(-) (limited to 'test/test_java_isolation_rootfs.py') diff --git a/test/test_java_isolation_rootfs.py b/test/test_java_isolation_rootfs.py index a401e23b..91773981 100644 --- a/test/test_java_isolation_rootfs.py +++ b/test/test_java_isolation_rootfs.py @@ -2,7 +2,6 @@ import os import subprocess import pytest - from unit.applications.lang.java import TestApplicationJava from unit.option import option -- cgit From ae035852385032cc6c502c0e560fc682cacdbf34 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 15 Nov 2021 12:13:54 +0000 Subject: Tests: refactored working with processes. --- test/test_java_isolation_rootfs.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'test/test_java_isolation_rootfs.py') 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: -- cgit