1c1 < import unittest --- > import pytest 13,14c13,14 < def setUpClass(cls, complete_check=True): < unit = super().setUpClass(complete_check=False) --- > def setup_class(cls, complete_check=True): > unit = super().setup_class(complete_check=False) 16c16 < TestFeatureIsolation().check(cls.available, unit.testdir) --- > TestFeatureIsolation().check(cls.available, unit.temp_dir) 20c20 < def test_python_isolation_rootfs(self): --- > def test_python_isolation_rootfs(self, is_su): 24,25c24 < print('requires mnt ns') < raise unittest.SkipTest() --- > pytest.skip('requires mnt ns') 27c26 < if not self.is_su: --- > if not is_su: 29,30c28 < print('requires unprivileged userns or root') < raise unittest.SkipTest() --- > pytest.skip('requires unprivileged userns or root') 33,34c31 < print('requires unprivileged userns or root') < raise unittest.SkipTest() --- > pytest.skip('requires unprivileged userns or root') 37,38c34,35 < 'namespaces': {'credential': not self.is_su, 'mount': True}, < 'rootfs': self.testdir, --- > 'namespaces': {'credential': not is_su, 'mount': True}, > 'rootfs': self.temp_dir, 43c40 < self.assertEqual(self.get()['status'], 200, 'python rootfs') --- > assert self.get()['status'] == 200, 'python rootfs' 47,51c44,47 < self.assertEqual( < self.getjson(url='/?path=' + self.testdir)['body']['FileExists'], < False, < 'testdir does not exists in rootfs', < ) --- > assert ( > self.getjson(url='/?path=' + self.temp_dir)['body']['FileExists'] > == False > ), 'temp_dir does not exists in rootfs' 53,57c49,52 < self.assertEqual( < self.getjson(url='/?path=/proc/self')['body']['FileExists'], < False, < 'no /proc/self', < ) --- > assert ( > self.getjson(url='/?path=/proc/self')['body']['FileExists'] > == False > ), 'no /proc/self' 59,63c54,56 < self.assertEqual( < self.getjson(url='/?path=/dev/pts')['body']['FileExists'], < False, < 'no /dev/pts', < ) --- > assert ( > self.getjson(url='/?path=/dev/pts')['body']['FileExists'] == False > ), 'no /dev/pts' 65,69c58,61 < self.assertEqual( < self.getjson(url='/?path=/sys/kernel')['body']['FileExists'], < False, < 'no /sys/kernel', < ) --- > assert ( > self.getjson(url='/?path=/sys/kernel')['body']['FileExists'] > == False > ), 'no /sys/kernel' 73,79c65,67 < self.assertEqual( < ret['body']['FileExists'], True, 'application exists in rootfs', < ) < < < if __name__ == '__main__': < TestPythonIsolation.main() --- > assert ( > ret['body']['FileExists'] == True > ), 'application exists in rootfs'