3c3 < import unittest --- > import pytest 11,12c11,14 < def setUp(self): < if not self.is_su: --- > def setup_method(self, is_su): > super().setup_method() > > if not is_su: 15c17,19 < super().setUp() --- > os.makedirs(self.temp_dir + '/jars') > os.makedirs(self.temp_dir + '/tmp') > os.chmod(self.temp_dir + '/tmp', 0o777) 17,20d20 < os.makedirs(self.testdir + '/jars') < os.makedirs(self.testdir + '/tmp') < os.chmod(self.testdir + '/tmp', 0o777) < 27c27 < self.testdir + "/jars", --- > self.temp_dir + "/jars", 35c35 < self.fail('Cann\'t run mount process.') --- > pytest.fail('Cann\'t run mount process.') 37,38c37,38 < def tearDown(self): < if not self.is_su: --- > def teardown_method(self, is_su): > if not is_su: 43c43 < ["umount", "--lazy", self.testdir + "/jars"], --- > ["umount", "--lazy", self.temp_dir + "/jars"], 50c50 < self.fail('Cann\'t run mount process.') --- > pytest.fail('Cann\'t run mount process.') 53c53 < super().tearDown() --- > super().teardown_method() 55,58c55,57 < def test_java_isolation_rootfs_chroot_war(self): < if not self.is_su: < print('require root') < raise unittest.SkipTest() --- > def test_java_isolation_rootfs_chroot_war(self, is_su): > if not is_su: > pytest.skip('require root') 61c60 < 'rootfs': self.testdir, --- > 'rootfs': self.temp_dir, 66,70c65,66 < self.assertIn( < 'success', < self.conf( < '"/"', '/config/applications/empty_war/working_directory', < ), --- > assert 'success' in self.conf( > '"/"', '/config/applications/empty_war/working_directory', 73,74c69,70 < self.assertIn( < 'success', self.conf('"/jars"', 'applications/empty_war/unit_jars') --- > assert 'success' in self.conf( > '"/jars"', 'applications/empty_war/unit_jars' 76,78c72,73 < self.assertIn( < 'success', < self.conf('"/java/empty.war"', 'applications/empty_war/webapp'), --- > assert 'success' in self.conf( > '"/java/empty.war"', 'applications/empty_war/webapp' 81,85c76 < self.assertEqual(self.get()['status'], 200, 'war') < < < if __name__ == '__main__': < TestJavaIsolationRootfs.main() --- > assert self.get()['status'] == 200, 'war'