test_get_pathinfo: testdir is unnecessary
authorRamakrishnan Muthukrishnan <ram@leastauthority.com>
Wed, 12 Aug 2015 09:47:27 +0000 (15:17 +0530)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 16:56:07 +0000 (17:56 +0100)
Use basedir itself, instead of creating another directory inside basedir.

src/allmydata/test/test_util.py

index c3fcc65c37ad78c1557a9af1c7e43f20635ba887..b34d12b0a0f0b5bf6aefbe7ac6ab21ae0a00fc27 100644 (file)
@@ -637,19 +637,18 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
     def test_get_pathinfo(self):
         basedir = "util/FileUtil/test_get_pathinfo"
         fileutil.make_dirs(basedir)
-        testdir = os.path.join(basedir, "foobar")
 
         # create a directory
-        self.mkdir(testdir, "a")
-        dirinfo = fileutil.get_pathinfo(testdir)
+        self.mkdir(basedir, "a")
+        dirinfo = fileutil.get_pathinfo(basedir)
         self.failUnlessTrue(dirinfo.isdir)
         self.failUnlessTrue(dirinfo.exists)
         self.failUnlessFalse(dirinfo.isfile)
         self.failUnlessFalse(dirinfo.islink)
 
         # create a file under the directory
-        f = os.path.join(testdir, "a/1.txt")
-        self.touch(testdir, "a/1.txt", data="a"*10)
+        f = os.path.join(basedir, "a/1.txt")
+        self.touch(basedir, "a/1.txt", data="a"*10)
         fileinfo = fileutil.get_pathinfo(f)
         self.failUnlessTrue(fileinfo.isfile)
         self.failUnlessTrue(fileinfo.exists)
@@ -658,7 +657,7 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
         self.failUnlessEqual(fileinfo.size, 10)
 
         # create a symlink under the directory a pointing to 1.txt
-        slname = os.path.join(testdir, "a/linkto1.txt")
+        slname = os.path.join(basedir, "a/linkto1.txt")
         os.symlink(f, slname)
         symlinkinfo = fileutil.get_pathinfo(slname)
         self.failUnlessTrue(symlinkinfo.islink)