Example #1
0
 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)
Example #2
0
 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)
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
 def test__init(self):
     "Test TemporaryPipe object creation"
     pipe = TemporaryPipe()
     self.assertIsNone(pipe.tempdir)
     self.assertEqual(pipe.pipename, "pipe")