test_python_isolation.py (1730:44912af5b3e6) test_python_isolation.py (1740:53149d20bb97)
1import shutil
2
3import pytest
4
1import shutil
2
3import pytest
4
5from conftest import unit_run
6from conftest import unit_stop
7from unit.applications.lang.python import TestApplicationPython
5from unit.applications.lang.python import TestApplicationPython
8from unit.feature.isolation import TestFeatureIsolation
9from unit.option import option
10
11
12class TestPythonIsolation(TestApplicationPython):
13 prerequisites = {'modules': {'python': 'any'}, 'features': ['isolation']}
14
6from unit.option import option
7
8
9class TestPythonIsolation(TestApplicationPython):
10 prerequisites = {'modules': {'python': 'any'}, 'features': ['isolation']}
11
15 @classmethod
16 def setup_class(cls, complete_check=True):
17 check = super().setup_class(complete_check=False)
18
19 unit = unit_run()
20 option.temp_dir = unit['temp_dir']
21
22 TestFeatureIsolation().check(option.available, unit['temp_dir'])
23
24 assert unit_stop() is None
25 shutil.rmtree(unit['temp_dir'])
26
27 return check if not complete_check else check()
28
29 def test_python_isolation_rootfs(self, is_su, temp_dir):
30 isolation_features = option.available['features']['isolation'].keys()
31
32 if not is_su:
33 if not 'unprivileged_userns_clone' in isolation_features:
34 pytest.skip('requires unprivileged userns or root')
35
36 if 'user' not in isolation_features:

--- 81 unchanged lines hidden ---
12 def test_python_isolation_rootfs(self, is_su, temp_dir):
13 isolation_features = option.available['features']['isolation'].keys()
14
15 if not is_su:
16 if not 'unprivileged_userns_clone' in isolation_features:
17 pytest.skip('requires unprivileged userns or root')
18
19 if 'user' not in isolation_features:

--- 81 unchanged lines hidden ---