def test__enter(self): "Test TemporaryPipe __enter__() method" expected = "/fake/tmp/dir/pipe" trace = """ Called tempfile.mkdtemp() Called os.mkfifo('/fake/tmp/dir/pipe')""" pipe = TemporaryPipe() path = pipe.__enter__() self.assertEqual(path, expected) assert_same_trace(self.tt, trace)
def test__exit(self): "Test TemporaryPipe __exit__() method" trace = "" pipe = TemporaryPipe() pipe.__exit__(None, None, None) assert_same_trace(self.tt, trace) pipe.tempdir = "foo" trace = " Called shutil.rmtree('foo')" pipe.__exit__(None, None, None) assert_same_trace(self.tt, trace)
def test__init(self): "Test TemporaryPipe object creation" pipe = TemporaryPipe() self.assertIsNone(pipe.tempdir) self.assertEqual(pipe.pipename, "pipe")