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


Python test.test_support方法代码示例

本文整理汇总了Python中test.test_support方法的典型用法代码示例。如果您正苦于以下问题:Python test.test_support方法的具体用法?Python test.test_support怎么用?Python test.test_support使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test的用法示例。


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

示例1: cleanup_testfn

# 需要导入模块: import test [as 别名]
# 或者: from test import test_support [as 别名]
def cleanup_testfn(self):
        path = test.test_support.TESTFN
        if os.path.isfile(path):
            os.remove(path)
        elif os.path.isdir(path):
            shutil.rmtree(path) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:test_sysconfig.py

示例2: test_parse_makefile_base

# 需要导入模块: import test [as 别名]
# 或者: from test import test_support [as 别名]
def test_parse_makefile_base(self):
        self.makefile = test.test_support.TESTFN
        fd = open(self.makefile, 'w')
        try:
            fd.write(r"CONFIG_ARGS=  '--arg1=optarg1' 'ENV=LIB'" '\n')
            fd.write('VAR=$OTHER\nOTHER=foo')
        finally:
            fd.close()
        d = sysconfig.parse_makefile(self.makefile)
        self.assertEqual(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'",
                             'OTHER': 'foo'}) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_sysconfig.py

示例3: test_parse_makefile_literal_dollar

# 需要导入模块: import test [as 别名]
# 或者: from test import test_support [as 别名]
def test_parse_makefile_literal_dollar(self):
        self.makefile = test.test_support.TESTFN
        fd = open(self.makefile, 'w')
        try:
            fd.write(r"CONFIG_ARGS=  '--arg1=optarg1' 'ENV=\$$LIB'" '\n')
            fd.write('VAR=$OTHER\nOTHER=foo')
        finally:
            fd.close()
        d = sysconfig.parse_makefile(self.makefile)
        self.assertEqual(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'",
                             'OTHER': 'foo'}) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_sysconfig.py

示例4: test_main

# 需要导入模块: import test [as 别名]
# 或者: from test import test_support [as 别名]
def test_main():
    global TEST_ALL
    TEST_ALL = test.test_support.is_resource_enabled("cpu")
    test.test_support.run_unittest(CompilerTest) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_compiler.py

示例5: testCompileLibrary

# 需要导入模块: import test [as 别名]
# 或者: from test import test_support [as 别名]
def testCompileLibrary(self):
        # A simple but large test.  Compile all the code in the
        # standard library and its test suite.  This doesn't verify
        # that any of the code is correct, merely the compiler is able
        # to generate some kind of code for it.

        next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
        # warning: if 'os' or 'test_support' are moved in some other dir,
        # they should be changed here.
        libdir = os.path.dirname(os.__file__)
        testdir = test.test_support.TEST_HOME_DIR

        for dir in [testdir]:
            for basename in "test_os.py",:
                # Print still working message since this test can be really slow
                if next_time <= time.time():
                    next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
                    print >>sys.__stdout__, \
                       '  testCompileLibrary still working, be patient...'
                    sys.__stdout__.flush()

                if not basename.endswith(".py"):
                    continue
                if not TEST_ALL and random() < 0.98:
                    continue
                path = os.path.join(dir, basename)
                if test.test_support.verbose:
                    print "compiling", path
                f = open(path, "U")
                buf = f.read()
                f.close()
                if "badsyntax" in basename or "bad_coding" in basename:
                    self.assertRaises(SyntaxError, compiler.compile,
                                      buf, basename, "exec")
                else:
                    try:
                        compiler.compile(buf, basename, "exec")
                    except Exception, e:
                        args = list(e.args)
                        args.append("in file %s]" % basename)
                        #args[0] += "[in file %s]" % basename
                        e.args = tuple(args)
                        raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:45,代码来源:test_compiler.py

示例6: testCompileLibrary

# 需要导入模块: import test [as 别名]
# 或者: from test import test_support [as 别名]
def testCompileLibrary(self):
        # A simple but large test.  Compile all the code in the
        # standard library and its test suite.  This doesn't verify
        # that any of the code is correct, merely the compiler is able
        # to generate some kind of code for it.

        next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
        # warning: if 'os' or 'test_support' are moved in some other dir,
        # they should be changed here.
        libdir = os.path.dirname(os.__file__)
        testdir = os.path.dirname(test.test_support.__file__)

        for dir in [testdir]:
            for basename in "test_os.py",:
                # Print still working message since this test can be really slow
                if next_time <= time.time():
                    next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
                    print >>sys.__stdout__, \
                       '  testCompileLibrary still working, be patient...'
                    sys.__stdout__.flush()

                if not basename.endswith(".py"):
                    continue
                if not TEST_ALL and random() < 0.98:
                    continue
                path = os.path.join(dir, basename)
                if test.test_support.verbose:
                    print "compiling", path
                f = open(path, "U")
                buf = f.read()
                f.close()
                if "badsyntax" in basename or "bad_coding" in basename:
                    self.assertRaises(SyntaxError, compiler.compile,
                                      buf, basename, "exec")
                else:
                    try:
                        compiler.compile(buf, basename, "exec")
                    except Exception, e:
                        args = list(e.args)
                        args.append("in file %s]" % basename)
                        #args[0] += "[in file %s]" % basename
                        e.args = tuple(args)
                        raise 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:45,代码来源:test_compiler.py


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