本文整理汇总了Python中txclib.project.Project._init方法的典型用法代码示例。如果您正苦于以下问题:Python Project._init方法的具体用法?Python Project._init怎么用?Python Project._init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txclib.project.Project
的用法示例。
在下文中一共展示了Project._init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wrapper
# 需要导入模块: from txclib.project import Project [as 别名]
# 或者: from txclib.project.Project import _init [as 别名]
def wrapper(*args, **kwargs):
app_dir = dirname(modules['txclib'].__file__)
config_file = app_dir + "/../tests/templates/config"
transifex_file = app_dir + "/../tests/templates/transifexrc"
with patch("txclib.utils.encode_args") as mock_encode_args, \
patch("txclib.utils.determine_charset")\
as mock_determine_charset, \
patch("txclib.utils.get_transifex_file",
return_value=transifex_file) \
as mock_get_transifex_file, \
patch("txclib.utils.get_config_file_path",
return_value=config_file) \
as mock_get_config_file_path, \
patch("txclib.utils.save_txrc_file") \
as mock_save_txrc_file, \
patch("txclib.project.Project._get_stats_for_resource") \
as mock_get_stats_for_resource:
# Create fake https response
def encode_args(*args, **kwargs):
struct = namedtuple("response", "data status close")
return struct(status=401, data="mock_response",
close=Mock())
mock_determine_charset.return_value = "utf-8"
mock_encode_args.return_value = encode_args
# Mock configuration files
p = Project(init=False)
p._init(path_to_tx=app_dir + "/../templates")
kwargs['mock_project'] = p
kwargs['mocks'] = {
'mock_determine_charset': mock_determine_charset,
"mock_encode_args": mock_encode_args,
"mock_get_config_file_path": mock_get_config_file_path,
"mock_get_stats_for_resource": mock_get_stats_for_resource,
"mock_get_transifex_file": mock_get_transifex_file,
"mock_save_txrc_file": mock_save_txrc_file
}
return func(*args, **kwargs)