本文整理汇总了Python中md.utilityFunctions.removeDir函数的典型用法代码示例。如果您正苦于以下问题:Python removeDir函数的具体用法?Python removeDir怎么用?Python removeDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removeDir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_readGroups01
def test_readGroups01(self):
fileContents = textwrap.dedent("""
gcc, *, * {
ccompiler = gcc
cflags = -O0
testVariable = baseVar
}
gcc, release, * {
cflags = -O2
testVariable = releaseVar
}
""")
try:
tempDir = mdTestUtilities.makeTempDir()
filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
groups = overrides.readGroups(filePath)
self.assertNotEquals(groups, None, "readGroups() failed to read groups")
self.assertEquals(len(groups), 2, "Wrong number of groups returned")
self.assertEquals(groups[0].compiler, "gcc", "readGroups() has wrong information")
self.assertEquals(groups[0].optimization, "*", "readGroups() has wrong information")
self.assertEquals(groups[0].parallel, "*", "readGroups() has wrong information")
self.assertEquals(fullCount(groups[0]), 3, "readGroups() has wrong information")
self.assertEquals(groups[0]["ccompiler"], "gcc", "readGroups() has wrong information")
self.assertEquals(groups[0]["cflags"], "-O0", "readGroups() has wrong information")
self.assertEquals(groups[0].defines["testvariable"], "baseVar", "readGroups() has wrong information")
self.assertEquals(groups[1].compiler, "gcc", "readGroups() has wrong information")
self.assertEquals(groups[1].optimization, "release", "readGroups() has wrong information")
self.assertEquals(groups[1].parallel, "*", "readGroups() has wrong information")
self.assertEquals(fullCount(groups[1]), 2, "readGroups() has wrong information")
self.assertEquals(groups[1]["cflags"], "-O2", "readGroups() has wrong information")
self.assertEquals(groups[1].defines["testvariable"], "releaseVar", "readGroups() has wrong information")
finally:
utilityFunctions.removeDir(tempDir)
示例2: test_getDependencies2
def test_getDependencies2(self):
try:
tempDir = mdTestUtilities.copyDirToTempDir("cases/cmake/hello/hello1")
dependencies = cmake.getDependencies(tempDir, verbose=False)
self.assertEquals(dependencies, [], "Wrong dependencies found in CMake project")
finally:
utilityFunctions.removeDir(tempDir)
示例3: test_pathExists2
def test_pathExists2(self):
try:
tempDir = mdTestUtilities.makeTempDir()
tempFile = mdTestUtilities.makeTempFile(tempDir)
self.assertEquals(utilityFunctions.pathExists(tempFile, True), True, "pathExists should have returned True")
finally:
utilityFunctions.removeDir(tempDir)
示例4: test_AutoToolsSimpleGraph
def test_AutoToolsSimpleGraph(self):
try:
mixDownPath = os.path.abspath("..")
origPath = os.environ["PATH"]
os.environ["PATH"] = mixDownPath + ":" + origPath
tempDir = mdTestUtilities.copyDirToTempDir("cases/simpleGraphAutoTools")
importRC = utilityFunctions.executeSubProcess("mixdown --import " + os.path.join(tempDir, "TestCaseA") + " " + os.path.join(tempDir, "TestCaseB") + " " + os.path.join(tempDir, "TestCaseC") + " " + os.path.join(tempDir, "TestCaseD"), tempDir)
self.assertEquals(importRC, 0, "AutoTools Simple Graph test case failed import.")
self.assertEquals(os.path.exists(os.path.join(tempDir, "TestCaseA.md")), True, "MixDown project file does not exist after importing AutoTools Simple Graph test case.")
buildRC = utilityFunctions.executeSubProcess("mixdown TestCaseA.md -ptestPrefix", tempDir)
self.assertEquals(buildRC, 0, "AutoTools Simple Graph test case failed build.")
cleanRC = utilityFunctions.executeSubProcess("mixdown --clean TestCaseA.md", tempDir)
self.assertEquals(cleanRC, 0, "AutoTools Simple Graph test case failed clean.")
prefix = os.path.join(tempDir, "testPrefix")
binDir = os.path.join(prefix, "bin")
self.assertEquals(os.path.exists(os.path.join(binDir, "TestCaseA")), True, "Executable A does not exist after building AutoTools Simple Graph test case.")
self.assertEquals(os.path.exists(os.path.join(binDir, "TestCaseB")), True, "Executable B does not exist after building AutoTools Simple Graph test case.")
self.assertEquals(os.path.exists(os.path.join(binDir, "TestCaseC")), True, "Executable C does not exist after building AutoTools Simple Graph test case.")
self.assertEquals(os.path.exists(os.path.join(binDir, "TestCaseD")), True, "Executable D does not exist after building AutoTools Simple Graph test case.")
finally:
utilityFunctions.removeDir(tempDir)
os.environ["PATH"] = origPath
示例5: test_findExecutables07
def test_findExecutables07(self):
try:
tempDir = mdTestUtilities.makeTempDir()
mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))
aDir = os.path.join(tempDir, 'a')
aGccExe = os.path.join(aDir, "gcc")
mdTestUtilities.createBlankFile(aGccExe)
mdTestUtilities.makeFileExecutable(aGccExe)
bDir = os.path.join(tempDir, 'b')
bIccExe = os.path.join(bDir, "icc")
mdTestUtilities.createBlankFile(bIccExe)
mdTestUtilities.makeFileExecutable(bIccExe)
acDir = os.path.join(os.path.join(tempDir, 'a'), 'c')
acIccExe = os.path.join(acDir, "icc")
mdTestUtilities.createBlankFile(acIccExe)
mdTestUtilities.makeFileExecutable(acIccExe)
exes = profiler.findExecutables([(tempDir, True)], ["icc", "gcc"])
self.assertEquals(len(exes), 3, "profiler.findExecutables did not find the right amount of executables")
self.assertTrue(aGccExe in exes, "profiler.findExecutables did not find the right executable")
self.assertTrue(bIccExe in exes, "profiler.findExecutables did not find the right executable")
self.assertTrue(acIccExe in exes, "profiler.findExecutables did not find the right executable")
finally:
utilityFunctions.removeDir(tempDir)
示例6: test_isAutoToolsProject4
def test_isAutoToolsProject4(self):
try:
tempDir = mdTestUtilities.makeTempDir()
tempFile = os.path.join(tempDir, "configure.ac")
mdTestUtilities.createBlankFile(tempFile)
self.assertTrue(autoTools.isAutoToolsProject(tempDir), "Failed to detect AutoTools project.")
finally:
utilityFunctions.removeDir(tempDir)
示例7: test_getDependenciesFalse2
def test_getDependenciesFalse2(self):
# False positive
try:
tempDir = mdTestUtilities.copyDirToTempDir("cases/simpleGraphAutoTools/TestCaseB")
dependencies = cmake.getDependencies(tempDir, verbose=False)
self.assertEquals(dependencies, None, "Wrong dependencies found in CMake project")
finally:
utilityFunctions.removeDir(tempDir)
示例8: test_isCMakeProject2
def test_isCMakeProject2(self):
try:
tempDir = mdTestUtilities.makeTempDir()
tempFile = os.path.join(tempDir, "CMakeLists.txt")
mdTestUtilities.createBlankFile(tempFile)
self.assertTrue(cmake.isCMakeProject(tempDir), "Failed to detect CMake project.")
finally:
utilityFunctions.removeDir(tempDir)
示例9: test_getDependencies6
def test_getDependencies6(self):
#False positive
try:
tempDir = mdTestUtilities.copyDirToTempDir("cases/cmake/hello/hello1")
dependencies = autoTools.getDependencies(tempDir, verbose=False)
self.assertEquals(dependencies, None, "Wrong dependencies found in AutoTools project")
finally:
utilityFunctions.removeDir(tempDir)
示例10: test_generateConfigureFiles
def test_generateConfigureFiles(self):
try:
tempDir = mdTestUtilities.copyDirToTempDir("cases/simpleGraphAutoTools/TestCaseA")
success = autoTools.generateConfigureFiles(tempDir, "testCaseTarget", False)
self.assertEquals(success, True, "Unable to generate configure files.")
self.assertEquals(os.path.exists(os.path.join(tempDir, "configure")), True, "Configure files did not exist after calling generateConfigureFiles.")
finally:
utilityFunctions.removeDir(tempDir)
示例11: test_getDependencies4
def test_getDependencies4(self):
try:
tempDir = mdTestUtilities.copyDirToTempDir("cases/simpleGraphAutoTools/TestCaseD")
success = autoTools.generateConfigureFiles(tempDir, "testCaseTarget", False)
self.assertEquals(success, True, "Unable to generate build files.")
dependencies = autoTools.getDependencies(tempDir, verbose=False)
self.assertEquals(dependencies, [], "Wrong dependencies found in AutoTools project")
finally:
utilityFunctions.removeDir(tempDir)
示例12: test_findExecutables06
def test_findExecutables06(self):
try:
tempDir = mdTestUtilities.makeTempDir()
testExe = os.path.join(tempDir, "gcc")
mdTestUtilities.createBlankFile(testExe)
mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))
exes = profiler.findExecutables([(tempDir, True)], ["gcc"])
self.assertEquals(len(exes), 0, "profiler.findExecutables did not find the right amount of executables")
finally:
utilityFunctions.removeDir(tempDir)
示例13: test_pathExists4
def test_pathExists4(self):
try:
tempDir = mdTestUtilities.makeTempDir()
self.assertEquals(
utilityFunctions.pathExists(os.path.join(tempDir, "test"), True),
False,
"pathExists should have returned False",
)
finally:
utilityFunctions.removeDir(tempDir)
示例14: test_targetPathToName01
def test_targetPathToName01(self):
try:
tempDir = mdTestUtilities.makeTempDir()
tarDir, tarName = mdTestUtilities.createBzipFile(tempDir)
tarPath = os.path.join(tempDir, tarName)
path = os.path.join(tempDir, "apr-1.4.5.tar.bz2")
shutil.move(tarPath, path)
name = target.targetPathToName(path)
self.assertEquals(name, "apr", "Wrong name returned")
finally:
utilityFunctions.removeDir(tempDir)
示例15: test_fetchURL
def test_fetchURL(self):
try:
tempDir = mdTestUtilities.makeTempDir()
tarDir, tarName = mdTestUtilities.createGzipFile(tempDir)
urlPath = "http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz"
pci = createPythonCallInfo(urlPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
pci = steps.fetch(pci)
self.assertEqual(pci.success, True, "Gzip file failed to fetch from URL.")
self.assertEqual(os.path.exists(pci.currentPath), True, "Gzip file did not exist after fetching.")
self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Gzip file was not a tar file after fetching.")
finally:
utilityFunctions.removeDir(tempDir)