本文整理汇总了Python中sys._called_from_test方法的典型用法代码示例。如果您正苦于以下问题:Python sys._called_from_test方法的具体用法?Python sys._called_from_test怎么用?Python sys._called_from_test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sys
的用法示例。
在下文中一共展示了sys._called_from_test方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _jit
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def _jit(function):
"""
Compile a function using a jit compiler.
The function is always compiled to check errors, but is only used outside
tests, so that code coverage analysis can be performed in jitted functions.
The tests set sys._called_from_test in conftest.py.
"""
import sys
compiled = numba.jit(function)
if hasattr(sys, '_called_from_test'):
return function
else: # pragma: no cover
return compiled
示例2: setUpClass
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def setUpClass(cls):
"Initialise parts of wxGlade before individual tests starts"
# set icon path back to the default default
#config.icons_path = 'icons'
# initialise wxGlade preferences and set some useful values
common.init_preferences()
config.preferences.autosave = False
config.preferences.write_timestamp = False
config.preferences.show_progress = False
#config.version = '"faked test version"'
# make e.g. the preview raise Exceptions
config.testing = True
# Determinate case and output directory
cls.caseDirectory = os.path.join( os.path.dirname(__file__), cls.caseDirectory )
cls.outDirectory = os.path.join( os.path.dirname(__file__), cls.outDirectory )
if not os.path.exists(cls.outDirectory): os.mkdir(cls.outDirectory)
# disable bug dialogs
sys._called_from_test = True
示例3: pytest_configure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def pytest_configure(config):
import sys
sys._called_from_test = True
示例4: pytest_configure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def pytest_configure(config):
sys._called_from_test = True
示例5: pytest_configure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def pytest_configure(config):
import sys
sys._called_from_test = True
示例6: pytest_configure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def pytest_configure(config):
"""set pytest sentinel"""
import sys
sys._called_from_test = True
示例7: pytest_unconfigure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def pytest_unconfigure(config):
if hasattr(sys, '_called_from_test'):
del sys._called_from_test
示例8: pytest_configure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import _called_from_test [as 别名]
def pytest_configure(config):
import sys
sys._called_from_test = True
config.addinivalue_line("markers", "example: Mark a given test as an example which can be run")
config.addinivalue_line(
"markers", "slow: Mark a given test as slower than most other tests, needing a special " "flag to run."
)