def test_devnull(self): sandbox = DirectorySandbox(self.dir) def _write(): f = open(os.devnull, 'w') f.write('xxx') f.close() sandbox.run(_write)
def test_win32com(self): """ win32com should not be prevented from caching COM interfaces in gen_py. """ import win32com gen_py = win32com.__gen_path__ target = os.path.join(gen_py, 'test_write') sandbox = DirectorySandbox(self.dir) try: try: sandbox.run(self._file_writer(target)) except SandboxViolation: self.fail("Could not create gen_py file due to SandboxViolation") finally: if os.path.exists(target): os.remove(target)
def test_devnull(self): if sys.version < '2.4': return sandbox = DirectorySandbox(self.dir) sandbox.run(self._file_writer(os.devnull))