summaryrefslogtreecommitdiffhomepage
path: root/test/test_static_mount.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_static_mount.py
parent28eaf9d37842a5d79d8081cc14fbf4cc7e7d49a5 (diff)
downloadunit-ae035852385032cc6c502c0e560fc682cacdbf34.tar.gz
unit-ae035852385032cc6c502c0e560fc682cacdbf34.tar.bz2
Tests: refactored working with processes.
Diffstat (limited to 'test/test_static_mount.py')
-rw-r--r--test/test_static_mount.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/test/test_static_mount.py b/test/test_static_mount.py
index e34a8a07..82eda956 100644
--- a/test/test_static_mount.py
+++ b/test/test_static_mount.py
@@ -22,7 +22,7 @@ class TestStaticMount(TestApplicationProto):
Path(temp_dir + '/assets/mount/index.html').write_text('mount')
try:
- process = subprocess.Popen(
+ subprocess.check_output(
[
"mount",
"--bind",
@@ -32,35 +32,33 @@ class TestStaticMount(TestApplicationProto):
stderr=subprocess.STDOUT,
)
- process.communicate()
-
except KeyboardInterrupt:
raise
- except:
+ except subprocess.CalledProcessError:
pytest.fail('Can\'t run mount process.')
self._load_conf(
{
"listeners": {"*:7080": {"pass": "routes"}},
- "routes": [{"action": {"share": temp_dir + "/assets/dir$uri"}}],
+ "routes": [
+ {"action": {"share": temp_dir + "/assets/dir$uri"}}
+ ],
}
)
yield
try:
- process = subprocess.Popen(
+ subprocess.check_output(
["umount", "--lazy", temp_dir + "/assets/dir/mount"],
stderr=subprocess.STDOUT,
)
- process.communicate()
-
except KeyboardInterrupt:
raise
- except:
+ except subprocess.CalledProcessError:
pytest.fail('Can\'t run umount process.')
def test_static_mount(self, temp_dir, skip_alert):