示例#1
0
    def test_recheck_real(self):
        # make a test file
        basedir = "/tmp/{0}/metis/file_test/".format(os.getenv("USER"))
        fname = "{0}/test.txt".format(basedir)
        Utils.do_cmd("mkdir -p {0}".format(basedir))
        Utils.do_cmd("touch {0}".format(fname))
        f = File(fname)

        # it exists
        self.assertEqual(f.exists(), True)
        # delete it
        Utils.do_cmd("rm {0}".format(fname))
        # it still exists due to caching (to avoid unnecessary `ls`)
        self.assertEqual(f.exists(), True)
        # force recheck/recache
        f.recheck()
        # now it doesn't exist
        self.assertEqual(f.exists(), False)
示例#2
0
 def test_file_exists(self):
     f = File(__file__)
     self.assertEqual(f.exists(), True)
示例#3
0
 def test_unset_fake(self):
     f = File("does_not_exist.root", fake=True)
     self.assertEqual(f.exists(), True)
     f.unset_fake()
     self.assertEqual(f.exists(), False)
示例#4
0
 def test_recheck_fake(self):
     f = File("does_not_exist.root", fake=True)
     self.assertEqual(f.exists(), True)
     f.recheck()
     self.assertEqual(f.exists(), True)
示例#5
0
 def test_not_exists(self):
     f = File("does_not_exist.root")
     self.assertEqual(f.exists(), False)