• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mdTestUtilities.makeTempDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_determineOutputPath3

 def test_determineOutputPath3(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         targetDir = os.path.join(tempDir, "targetDir")
         os.makedirs(targetDir)
         option = options.Options()
         option.buildDir = "."
         option.cleanMode = True
         targets = target.Target("foo", targetDir)
         targets.outputPath = targets.determineOutputPath(option)
         self.assertEquals(targets.outputPath, targetDir, "During cleaning found target path should not be overwritten.")
     finally:
         utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:13,代码来源:test_target.py


示例17: test_fetchSvn

 def test_fetchSvn(self):
     if not svn.isSvnInstalled():
         self.fail("Svn is not installed on your system.  All Svn tests will fail.")
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createSvnRepository(tempDir)
         pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True, "Svn repository failed to fetch.")
         self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Svn repository.")
     finally:
         utilityFunctions.removeDir(tempDir)
开发者ID:tepperly,项目名称:MixDown,代码行数:13,代码来源:test_steps.py


示例18: test_isGitRepoCase1

 def test_isGitRepoCase1(self):
     #Case 1: Local directory that is a git repository
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     #Create repository and test if is git repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     try:
         self.assertTrue(git.isGitRepo(tempRepo), "git.isGitRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(git.isGitRepo(falsePath), "git.isGitRepo(" + falsePath + ") should have returned false.")
开发者ID:tepperly,项目名称:MixDown,代码行数:14,代码来源:test_git.py


示例19: test_isHgRepoCase1

 def test_isHgRepoCase1(self):
     #Case 1: Local directory that is a Hg repository
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     #Create repository and test if is Hg repo
     tempDir = mdTestUtilities.makeTempDir()
     path = mdTestUtilities.createHgRepository(tempDir)
     try:
         self.assertTrue(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(hg.isHgRepo(falsePath), "hg.isHgRepo(" + falsePath + ") should have returned false.")
开发者ID:tepperly,项目名称:MixDown,代码行数:14,代码来源:test_hg.py


示例20: test_subversion

    def test_subversion(self):
        svnURL = "http://subversion.tigris.org/downloads/subversion-1.6.12.tar.bz2"
        aprURL = "http://mirror.candidhosting.com/pub/apache/apr/apr-1.4.6.tar.bz2"
        aprUtilURL = "http://mirror.candidhosting.com/pub/apache//apr/apr-util-1.3.12.tar.gz"
        neonURL = "http://www.webdav.org/neon/neon-0.29.5.tar.gz"
        sqliteURL = "http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz"

        skipAPRPreconfig = ""
        if socket.gethostname() == "tux316.llnl.gov":
            skipAPRPreconfig = " -sapr:preconfig"
        try:
            mixDownPath = os.path.abspath("..")
            origPath = os.environ["PATH"]
            os.environ["PATH"] = mixDownPath + ":" + origPath

            tempDir = mdTestUtilities.makeTempDir()
            downloadDir = os.path.join(tempDir, "testDownloadFiles")

            svnPath = utilityFunctions.downloadFile(svnURL, downloadDir)
            self.assertNotEquals(svnPath, "", "Svn failed to download")

            aprPath = utilityFunctions.downloadFile(aprURL, downloadDir)
            self.assertNotEquals(aprPath, "", "Apr failed to download")

            aprUtilPath = utilityFunctions.downloadFile(aprUtilURL, downloadDir)
            self.assertNotEquals(aprUtilPath, "", "Apr Util failed to download")

            neonPath = utilityFunctions.downloadFile(neonURL, downloadDir)
            self.assertNotEquals(neonPath, "", "Neon failed to download")

            sqlitePath = utilityFunctions.downloadFile(sqliteURL, downloadDir)
            self.assertNotEquals(sqlitePath, "", "Sqlite failed to download")

            importRC = utilityFunctions.executeSubProcess("mixdown --import " + svnPath + " " + aprPath + " " + aprUtilPath + " " + neonPath + " " + sqlitePath, tempDir)
            self.assertEquals(importRC, 0, "Subversion test case failed import.")

            buildRC = utilityFunctions.executeSubProcess("mixdown subversion-1.6.12.md -ptestPrefix" + skipAPRPreconfig, tempDir)
            self.assertEquals(buildRC, 0, "Subversion test case failed build.")

            cleanRC = utilityFunctions.executeSubProcess("mixdown --clean subversion-1.6.12.md", tempDir)
            self.assertEquals(cleanRC, 0, "Subversion test case failed clean.")

            prefix = os.path.join(tempDir, "testPrefix")
            binDir = os.path.join(prefix, "bin")
            libDir = os.path.join(prefix, "lib")
            self.assertEquals(os.path.exists(os.path.join(binDir, "svn")), True, "Executable does not exist after building CMake Hello test case.")
        finally:
            utilityFunctions.removeDir(tempDir)
            os.environ["PATH"] = origPath
开发者ID:tepperly,项目名称:MixDown,代码行数:49,代码来源:test_MixDownLong.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python md_common.capture_stderr函数代码示例发布时间:2022-05-27
下一篇:
Python md5.new函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap