def testFilesBeneathRecursive(self): with cd(os.path.join(ASSETS_DIR, "files-beneath")): files = list(clcache.filesBeneath(".")) self.assertEqual(len(files), 5) self.assertIn(r".\a\1.txt", files) self.assertIn(r".\a\2.txt", files) self.assertIn(r".\b\c\3.txt", files) self.assertIn(r".\d\4.txt", files) self.assertIn(r".\d\e\5.txt", files)
def setUpClass(cls): cls.tempDir = tempfile.TemporaryDirectory() for i in range(10): sampleName = 'sample{}.h'.format(i) filePath = os.path.join(cls.tempDir.name, '{}.h'.format(sampleName)) with open(filePath, 'w') as f: f.write('#define {}'.format(sampleName)) cls.includePaths = list(sorted(clcache.filesBeneath(cls.tempDir.name))) cls.manifestHash = 'ffffffffffffffffffffffffffffffff' cls.expectedManifestEntry = clcache.createManifestEntry(TestCreateManifestEntry.manifestHash, TestCreateManifestEntry.includePaths)
def testFilesBeneathDeep(self): with cd(os.path.join(ASSETS_DIR, "files-beneath")): files = list(clcache.filesBeneath("b")) self.assertEqual(len(files), 1) self.assertIn(r"b\c\3.txt", files)
def testFilesBeneathSimple(self): with cd(os.path.join(ASSETS_DIR, "files-beneath")): files = list(clcache.filesBeneath("a")) self.assertEqual(len(files), 2) self.assertIn(r"a\1.txt", files) self.assertIn(r"a\2.txt", files)