Permalink
Browse files

Write a failing test for makedirs_p returning itself

  • Loading branch information...
1 parent dd5d16a commit 4bb8efb5e53a3ec38c4b0bae5ac246b03ab3b1bf @xentac xentac committed Nov 13, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 test_path.py
View
@@ -127,6 +127,23 @@ def testUNC(self):
self.assert_(p.uncshare == r'\\python1\share1')
self.assert_(p.splitunc() == os.path.splitunc(str(p)))
+class ReturnSelfTestCase(unittest.TestCase):
+ def setUp(self):
+ # Create a temporary directory.
+ f = tempfile.mktemp()
+ system_tmp_dir = os.path.dirname(f)
+ my_dir = 'testpath_tempdir_' + str(random.random())[2:]
+ self.tempdir = os.path.join(system_tmp_dir, my_dir)
+ os.mkdir(self.tempdir)
+
+ def tearDown(self):
+ shutil.rmtree(self.tempdir)
+
+ def testMakedirs_pReturnsSelf(self):
+ p = path(self.tempdir) / "newpath"
+ ret = p.makedirs_p()
+ self.assertEquals(p, ret)
+
class TempDirTestCase(unittest.TestCase):
def setUp(self):
# Create a temporary directory.

0 comments on commit 4bb8efb

Please sign in to comment.