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

Python script_helper.temp_dir函数代码示例

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

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



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

示例1: test_main_recursion_error

 def test_main_recursion_error(self):
     with temp_dir() as script_dir, temp_dir() as dummy_dir:
         mod_name = "__main__"
         source = ("import runpy\n" "runpy.run_path(%r)\n") % dummy_dir
         script_name = self._make_test_script(script_dir, mod_name, source)
         zip_name, fname = make_zip_script(script_dir, "test_zip", script_name)
         msg = "recursion depth exceeded"
         self.assertRaisesRegexp(RuntimeError, msg, run_path, zip_name)
开发者ID:lzjun567,项目名称:python2.7,代码行数:8,代码来源:test_runpy.py


示例2: test_directory_compiled

 def test_directory_compiled(self):
     with temp_dir() as script_dir:
         mod_name = "__main__"
         script_name = self._make_test_script(script_dir, mod_name)
         compiled_name = compile_script(script_name)
         os.remove(script_name)
         self._check_script(script_dir, "<run_path>", compiled_name, script_dir, "")
开发者ID:lzjun567,项目名称:python2.7,代码行数:7,代码来源:test_runpy.py


示例3: test_basic_script

 def test_basic_script(self):
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, 'script')
         package = '' if support.check_impl_detail(pypy=True) else None
         self._check_script(script_name, script_name, script_name,
                            script_dir, package,
                            importlib.machinery.SourceFileLoader)
开发者ID:timm,项目名称:timmnix,代码行数:7,代码来源:test_cmd_line_script.py


示例4: test_script_compiled

 def test_script_compiled(self):
     with temp_dir() as script_dir:
         mod_name = "script"
         script_name = self._make_test_script(script_dir, mod_name)
         compiled_name = compile_script(script_name)
         os.remove(script_name)
         self._check_script(compiled_name, "<run_path>", compiled_name, compiled_name, None)
开发者ID:lzjun567,项目名称:python2.7,代码行数:7,代码来源:test_runpy.py


示例5: test_zipfile_error

 def test_zipfile_error(self):
     with temp_dir() as script_dir:
         mod_name = 'not_main'
         script_name = self._make_test_script(script_dir, mod_name)
         zip_name, fname = make_zip_script(script_dir, 'test_zip', script_name)
         msg = "can't find '__main__' module in %r" % zip_name
         self._check_import_error(zip_name, msg)
开发者ID:edmundgentle,项目名称:schoolscript,代码行数:7,代码来源:test_runpy.py


示例6: test_doctest_main_issue4197

    def test_doctest_main_issue4197(self):
        test_src = textwrap.dedent("""\
                    class Test:
                        ">>> 'line 2'"
                        pass

                    import doctest
                    doctest.testmod()
                    """)
        pattern = 'File "%s", line 2, in %s'
        with temp_dir() as d:
            script_name = make_script(d, 'script', test_src)
            exit_code, data = run_python(script_name)
            expected = pattern % (script_name, "__main__.Test")
            if verbose:
                print "Expected line", expected
                print "Got stdout:"
                print data
            self.assertIn(expected, data)
            zip_name, run_name = make_zip_script(d, "test_zip",
                                                script_name, '__main__.py')
            exit_code, data = run_python(zip_name)
            expected = pattern % (run_name, "__main__.Test")
            if verbose:
                print "Expected line", expected
                print "Got stdout:"
                print data
            self.assertIn(expected, data)
开发者ID:aepstein,项目名称:python,代码行数:28,代码来源:test_zipimport_support.py


示例7: test_zipfile_compiled

 def test_zipfile_compiled(self):
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, '__main__')
         compiled_name = py_compile.compile(script_name, doraise=True)
         zip_name, run_name = make_zip_script(script_dir, 'test_zip', compiled_name)
         self._check_script(zip_name, run_name, zip_name, zip_name, '',
                            zipimport.zipimporter)
开发者ID:BeboPremo,项目名称:cpython,代码行数:7,代码来源:test_cmd_line_script.py


示例8: test_module_in_subpackage_in_zipfile

 def test_module_in_subpackage_in_zipfile(self):
     with temp_dir() as script_dir:
         zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
         launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
         self._check_script(launch_name, run_name, run_name,
                            zip_name, 'test_pkg.test_pkg',
                            zipimport.zipimporter)
开发者ID:BeboPremo,项目名称:cpython,代码行数:7,代码来源:test_cmd_line_script.py


示例9: test_zipfile_compiled

 def test_zipfile_compiled(self):
     with temp_dir() as script_dir:
         mod_name = "__main__"
         script_name = self._make_test_script(script_dir, mod_name)
         compiled_name = py_compile.compile(script_name, doraise=True)
         zip_name, fname = make_zip_script(script_dir, "test_zip", compiled_name)
         self._check_script(zip_name, "<run_path>", fname, zip_name, "")
开发者ID:RockySteveJobs,项目名称:python-for-android,代码行数:7,代码来源:test_runpy.py


示例10: test_module_in_package

 def test_module_in_package(self):
     with temp_dir() as script_dir:
         pkg_dir = os.path.join(script_dir, 'test_pkg')
         make_pkg(pkg_dir)
         script_name = _make_test_script(pkg_dir, 'script')
         launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script')
         self._check_script(launch_name, script_name, script_name, 'test_pkg')
开发者ID:EnviroCentre,项目名称:jython-upgrade,代码行数:7,代码来源:test_cmd_line_script.py


示例11: test_package_error

 def test_package_error(self):
     with temp_dir() as script_dir:
         pkg_dir = os.path.join(script_dir, "test_pkg")
         make_pkg(pkg_dir)
         msg = "'test_pkg' is a package and cannot " "be directly executed"
         launch_name = _make_launch_script(script_dir, "launch", "test_pkg")
         self._check_import_error(launch_name, msg)
开发者ID:hsienchieh,项目名称:uefilab,代码行数:7,代码来源:test_cmd_line_script.py


示例12: test_zipfile

 def test_zipfile(self):
     source = self.main_in_children_source
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, '__main__',
                                         source=source)
         zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
         self._check_script(zip_name)
开发者ID:alex,项目名称:cpython,代码行数:7,代码来源:test_multiprocessing_main_handling.py


示例13: test_package

 def test_package(self):
     with temp_dir() as script_dir:
         pkg_dir = os.path.join(script_dir, "test_pkg")
         make_pkg(pkg_dir)
         script_name = _make_test_script(pkg_dir, "__main__")
         launch_name = _make_launch_script(script_dir, "launch", "test_pkg")
         self._check_script(launch_name, script_name, script_name, "test_pkg")
开发者ID:hsienchieh,项目名称:uefilab,代码行数:7,代码来源:test_cmd_line_script.py


示例14: test_script_compiled

 def test_script_compiled(self):
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, "script")
         py_compile.compile(script_name, doraise=True)
         os.remove(script_name)
         pyc_file = support.make_legacy_pyc(script_name)
         self._check_script(pyc_file, pyc_file, pyc_file, script_dir, None, importlib.machinery.SourcelessFileLoader)
开发者ID:GaloisInc,项目名称:echronos,代码行数:7,代码来源:test_cmd_line_script.py


示例15: test_zipfile_compiled

 def test_zipfile_compiled(self):
     with temp_dir() as script_dir:
         mod_name = '__main__'
         script_name = self._make_test_script(script_dir, mod_name)
         compiled_name = compile_script(script_name)
         zip_name, fname = make_zip_script(script_dir, 'test_zip', compiled_name)
         self._check_script(zip_name, "<run_path>", fname, zip_name, '')
开发者ID:mozillazg,项目名称:pypy,代码行数:7,代码来源:test_runpy.py


示例16: test_script_compiled

 def test_script_compiled(self):
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, 'script')
         py_compile.compile(script_name, doraise=True)
         os.remove(script_name)
         pyc_file = support.make_legacy_pyc(script_name)
         self._check_script(pyc_file)
开发者ID:alex,项目名称:cpython,代码行数:7,代码来源:test_multiprocessing_main_handling.py


示例17: test_zipfile

 def test_zipfile(self):
     with temp_dir() as script_dir:
         mod_name = '__main__'
         script_name = self._make_test_script(script_dir, mod_name)
         zip_name, fname = make_zip_script(script_dir, 'test_zip', script_name)
         self._check_script(zip_name, "<run_path>", fname, zip_name,
                            mod_name=mod_name, check_loader=False)
开发者ID:isaiah,项目名称:jython3,代码行数:7,代码来源:test_runpy.py


示例18: test_basic_script_no_suffix

 def test_basic_script_no_suffix(self):
     with temp_dir() as script_dir:
         mod_name = 'script'
         script_name = self._make_test_script(script_dir, mod_name,
                                              omit_suffix=True)
         self._check_script(script_name, "<run_path>", script_name,
                            script_name, expect_spec=False)
开发者ID:isaiah,项目名称:jython3,代码行数:7,代码来源:test_runpy.py


示例19: test_zipfile_compiled

 def test_zipfile_compiled(self):
     source = self.main_in_children_source
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, '__main__',
                                         source=source)
         compiled_name = py_compile.compile(script_name, doraise=True)
         zip_name, run_name = make_zip_script(script_dir, 'test_zip', compiled_name)
         self._check_script(zip_name)
开发者ID:alex,项目名称:cpython,代码行数:8,代码来源:test_multiprocessing_main_handling.py


示例20: test_script_compiled

 def test_script_compiled(self):
     with temp_dir() as script_dir:
         mod_name = 'script'
         script_name = self._make_test_script(script_dir, mod_name)
         compiled_name = py_compile.compile(script_name, doraise=True)
         os.remove(script_name)
         self._check_script(compiled_name, "<run_path>", compiled_name,
                            compiled_name, None)
开发者ID:edmundgentle,项目名称:schoolscript,代码行数:8,代码来源:test_runpy.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python server.SERVER类代码示例发布时间:2022-05-27
下一篇:
Python script_helper.spawn_python函数代码示例发布时间: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