当前位置: 首页>>代码示例>>Python>>正文


Python mdTestUtilities.makeTempDir函数代码示例

本文整理汇总了Python中mdTestUtilities.makeTempDir函数的典型用法代码示例。如果您正苦于以下问题:Python makeTempDir函数的具体用法?Python makeTempDir怎么用?Python makeTempDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了makeTempDir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:28,代码来源:test_profiler.py

示例2: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:7,代码来源:test_utilityFunctions.py

示例3: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:35,代码来源:test_overrides.py

示例4: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:8,代码来源:test_autoTools.py

示例5: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:8,代码来源:test_cmake.py

示例6: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:10,代码来源:test_utilityFunctions.py

示例7: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:10,代码来源:test_profiler.py

示例8: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:11,代码来源:test_target.py

示例9: test_processCommandline09

    def test_processCommandline09(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " --import --clean"
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), False, "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [], "targetsToImport should have not been set")
        finally:
            utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_options.py

示例10: test_fetchTar

 def test_fetchTar(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createTarFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         pci = createPythonCallInfo(tarPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True, "Local tar file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True, "Tar file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Tar file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_steps.py

示例11: 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)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_steps.py

示例12: test_hgCheckout

 def test_hgCheckout(self):
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createHgRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         hg.hgCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(os.path.join(checkedOutRepo, "testFile"))
         self.assertEqual(returnValue, True, "'testFile' did not exist after hg.hgCheckout(" + tempRepo + ") was called.")
     finally:
         utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_hg.py

示例13: test_pathExists5

 def test_pathExists5(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         directory = os.path.join(tempDir, "testDir")
         os.makedirs(directory)
         mdTestUtilities.createBlankFile(os.path.join(directory, "test"))
         wrongPath = os.path.join(os.path.join(tempDir, "TeStDiR"), "test")
         self.assertEquals(
             utilityFunctions.pathExists(wrongPath, True), False, "pathExists should have returned False"
         )
     finally:
         utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_utilityFunctions.py

示例14: test_gitCheckout

 def test_gitCheckout(self):
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         git.gitCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(os.path.join(checkedOutRepo, mdTestUtilities.testFileName))
         self.assertEqual(returnValue, True, "'" + mdTestUtilities.testFileName + "' did not exist after git.gitCheckout(" + tempRepo + ") was called.")
     finally:
         utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_git.py

示例15: test_validate02

    def test_validate02(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown " + projectFilePath + " -ptestPrefix -v -ggcc,debug,parallel"
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), True, "Command-line should have processed correctly")
            self.assertEquals(testOptions.validate(), False, "Command-line options should not have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:12,代码来源:test_options.py


注:本文中的mdTestUtilities.makeTempDir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。