def test_makereadonly_dir(self): temp = tempfile.mkdtemp() try: self.assertTrue(is_writable(temp)) make_readonly(temp) self.assertFalse(is_writable(temp)) finally: rmtree_readonly(temp)
def test_makereadonly_file(self): f = tempfile.NamedTemporaryFile() path = Path(f.name) self.assertTrue(is_writable(path)) make_readonly(path) self.assertFalse(is_writable(path))