From fbbd21775ced50fd5efd651eaa21ff74da74a788 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 10:41:38 -0700 Subject: [PATCH] test_scripts: delete the named pipe when we're done Otherwise, running "pip wheel ." from the source directory will fail (it chokes while trying to copy the pipe inside _trial_test/). Arguably pip shouldn't be doing a full copy, but until/unless they change that, this is an easy workaround. --- tests/test_scripts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 13a59e6..d05f148 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -12,6 +12,14 @@ from wormhole.errors import TransferError from wormhole.timing import DebugTiming class Phase1Data(unittest.TestCase): + def setUp(self): + self._things_to_delete = [] + + def tearDown(self): + for fn in self._things_to_delete: + if os.path.exists(fn): + os.unlink(fn) + def test_text(self): message = "blah blah blah ponies" @@ -127,6 +135,13 @@ class Phase1Data(unittest.TestCase): os.mkfifo(abs_filename) except AttributeError: raise unittest.SkipTest("is mkfifo supported on this platform?") + + # Delete the named pipe for the sake of users who might run "pip + # wheel ." in this directory later. That command wants to copy + # everything into a tempdir before building a wheel, and the + # shutil.copy_tree() is uses can't handle the named pipe. + self._things_to_delete.append(abs_filename) + self.assertFalse(os.path.isfile(abs_filename)) self.assertFalse(os.path.isdir(abs_filename))