本文整理匯總了Python中releng.test.utils.TestHelper.assertOutputJsonFile方法的典型用法代碼示例。如果您正苦於以下問題:Python TestHelper.assertOutputJsonFile方法的具體用法?Python TestHelper.assertOutputJsonFile怎麽用?Python TestHelper.assertOutputJsonFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類releng.test.utils.TestHelper
的用法示例。
在下文中一共展示了TestHelper.assertOutputJsonFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_CrossVerifyRequestQuiet
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_CrossVerifyRequestQuiet(self):
helper = TestHelper(self, workspace='ws', env={
'BUILD_URL': 'http://build',
'GERRIT_PROJECT': 'gromacs',
'GERRIT_CHANGE_URL': 'http://gerrit',
'GERRIT_PATCHSET_NUMBER': '3',
'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Cross-verify 1234 quiet')
})
input_lines = [
'gcc-4.6 gpu cuda-5.0',
'msvc-2013'
]
helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
'\n'.join(input_lines) + '\n')
factory = helper.factory
executor = helper.executor
get_actions_from_triggering_comment(factory, 'actions.json')
helper.assertOutputJsonFile('ws/build/actions.json', {
'builds': [
{
'type': 'matrix',
'desc': 'cross-verify',
'options': '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
}
],
'env': {
'REGRESSIONTESTS_REFSPEC': 'refs/changes/34/1234/5',
'REGRESSIONTESTS_HASH': '1234567890abcdef0123456789abcdef01234567'
}
})
示例2: TestStatusReporterNoPropagate
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
class TestStatusReporterNoPropagate(unittest.TestCase):
def setUp(self):
env = {
'STATUS_FILE': 'logs/status.json',
'NO_PROPAGATE_FAILURE': '1'
}
self.helper = TestHelper(self, workspace='ws', env=env)
def test_Failure(self):
with self.helper.factory.status_reporter as status_reporter:
status_reporter.mark_failed('Failure reason')
self.assertFalse(self.helper.executor.exit.called)
self.helper.assertConsoleOutput("""\
Build FAILED:
Failure reason
""")
self.helper.assertOutputJsonFile('ws/logs/status.json', {
'result': 'FAILURE',
'reason': 'Failure reason'
})
def test_Aborted(self):
with self.helper.factory.status_reporter as status_reporter:
raise AbortError(143)
self.assertFalse(self.helper.executor.exit.called)
self.helper.assertOutputJsonFile('ws/logs/status.json', {
'result': 'ABORTED',
'reason': None
})
示例3: test_ReleaseBranchRequest
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_ReleaseBranchRequest(self):
helper = TestHelper(self, workspace='ws', env={
'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] release-2016')
})
input_lines = [
'gcc-4.6 gpu cuda-5.0',
'msvc-2013'
]
helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
'\n'.join(input_lines) + '\n')
factory = helper.factory
executor = helper.executor
get_actions_from_triggering_comment(factory, 'actions.json')
self.maxDiff = None
helper.assertOutputJsonFile('ws/build/actions.json', {
'builds': [
{
'type': 'matrix',
'desc': 'release-2016',
'options': '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
},
{ 'type': 'clang-analyzer', 'desc': 'release-2016' },
{ 'type': 'cppcheck', 'desc': 'release-2016' },
{ 'type': 'documentation', 'desc': 'release-2016' },
{ 'type': 'uncrustify', 'desc': 'release-2016' }
],
'env': {
'GROMACS_REFSPEC': 'refs/heads/release-2016',
'GROMACS_HASH': '1234567890abcdef0123456789abcdef01234567',
'REGRESSIONTESTS_REFSPEC': 'refs/heads/release-2016',
'REGRESSIONTESTS_HASH': '1234567890abcdef0123456789abcdef01234567'
}
})
示例4: test_GetBuildRevisionsNoRegressionTests
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_GetBuildRevisionsNoRegressionTests(self):
helper = TestHelper(self, env={
'WORKSPACE': 'ws',
'CHECKOUT_PROJECT': 'gromacs',
'CHECKOUT_REFSPEC': 'refs/changes/34/1234/5',
'GROMACS_REFSPEC': 'refs/changes/34/1234/5',
'RELENG_REFSPEC': 'refs/heads/master'
})
workspace = helper.factory.workspace
workspace._get_build_revisions('build-revisions.json')
helper.assertOutputJsonFile('build-revisions.json', [
{
'project': 'gromacs',
'hash_env': 'GROMACS_HASH',
'refspec_env': 'GROMACS_REFSPEC',
'refspec': 'refs/changes/34/1234/5',
'hash': '1234567890abcdef0123456789abcdef01234567',
'title': 'Mock title'
},
{
'project': 'releng',
'hash_env': 'RELENG_HASH',
'refspec_env': 'RELENG_REFSPEC',
'refspec': 'refs/heads/master',
'hash': '1234567890abcdef0123456789abcdef01234567',
'title': 'Mock title'
}
])
示例5: test_SingleBuildWithCrossVerify
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_SingleBuildWithCrossVerify(self):
helper = TestHelper(self, workspace='ws', env={
'GERRIT_CHANGE_URL': 'http://gerrit',
'GERRIT_PATCHSET_NUMBER': '3',
})
factory = helper.factory
helper.add_input_json_file('actions.json', {
'builds': [
{
'url': 'http://my_build',
'desc': None,
'result': 'SUCCESS'
}
],
'gerrit_info': {
'change': 1234,
'patchset': 5
}
})
do_post_build(factory, 'actions.json', 'message.json')
helper.assertOutputJsonFile('ws/build/message.json', {
'url': 'http://my_build',
'message': None
})
helper.assertCommandInvoked(['ssh', '-p', '29418', '[email protected]', 'gerrit', 'review', '1234,5', '-m', '"Cross-verify with http://gerrit (patch set 3) finished\n\nhttp://my_build: SUCCESS"'])
示例6: test_NoBuild
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_NoBuild(self):
helper = TestHelper(self, workspace='ws')
factory = helper.factory
helper.add_input_json_file('actions.json', {
'builds': []
})
do_post_build(factory, 'actions.json', 'message.json')
helper.assertOutputJsonFile('ws/build/message.json', {
'url': None,
'message': None
})
示例7: TestPrepareBuildMatrix
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
class TestPrepareBuildMatrix(unittest.TestCase):
def setUp(self):
self.helper = TestHelper(self, workspace='ws')
def test_PrepareBuildMatrix(self):
factory = self.helper.factory
executor = self.helper.executor
input_lines = [
'gcc-4.6 gpu cuda-5.0',
'clang-3.4 no-openmp asan',
'msvc-2013',
'msvc-2015 icc-16.0'
]
self.helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
'\n'.join(input_lines) + '\n')
prepare_build_matrix(factory, 'pre-submit-matrix', 'matrix.txt')
self.assertEqual(executor.method_calls, [
mock.call.ensure_dir_exists('ws/build', ensure_empty=True),
mock.call.read_file('ws/gromacs/admin/builds/pre-submit-matrix.txt'),
mock.call.write_file('ws/build/matrix.txt',
'OPTIONS "{0} host=bs_nix1310" "{1} host=bs_nix-amd" "{2} host=bs-win2012r2" "{3} host=bs-win2012r2"\n'.format(*[x.strip() for x in input_lines]))
])
def test_PrepareBuildMatrixJson(self):
factory = self.helper.factory
executor = self.helper.executor
input_lines = [
'gcc-4.6 gpu cuda-5.0',
'msvc-2013'
]
self.helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
'\n'.join(input_lines) + '\n')
prepare_build_matrix(factory, 'pre-submit-matrix', 'matrix.json')
self.helper.assertOutputJsonFile('ws/build/matrix.json', [
{
"host": "bs_nix1310",
"labels": "cuda-5.0 && gcc-4.6",
"opts": ["gcc-4.6", "gpu", "cuda-5.0"]
},
{
"host": "bs-win2012r2",
"labels": "msvc-2013",
"opts": ["msvc-2013"]
}
])
self.assertEqual(executor.method_calls, [
mock.call.ensure_dir_exists('ws/build', ensure_empty=True),
mock.call.read_file('ws/gromacs/admin/builds/pre-submit-matrix.txt'),
mock.call.write_file('ws/build/matrix.json', mock.ANY)
])
示例8: test_SingleBuildWithDescription
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_SingleBuildWithDescription(self):
helper = TestHelper(self, workspace='ws')
factory = helper.factory
helper.add_input_json_file('actions.json', {
'builds': [
{
'url': 'http://my_build',
'desc': 'cross-verify',
'result': 'SUCCESS'
}
]
})
do_post_build(factory, 'actions.json', 'message.json')
helper.assertOutputJsonFile('ws/build/message.json', {
'url': 'http://my_build (cross-verify)',
'message': None
})
示例9: TestReadBuildScriptConfig
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
class TestReadBuildScriptConfig(unittest.TestCase):
def setUp(self):
self.helper = TestHelper(self, workspace='/ws')
def test_ClangAnalyzer(self):
self.helper.add_input_file('script/build.py',
"""\
build_options = ['clang-3.8', 'clang-static-analyzer-3.8']
def do_build(context):
pass
""")
BuildContext._read_build_script_config(self.helper.factory,
'script/build.py', 'config.json')
self.helper.assertOutputJsonFile('/ws/build/config.json', {
'opts': ['clang-3.8', 'clang-static-analyzer-3.8'],
'host': 'bs_nix-static_analyzer',
'labels': 'clang-3.8 && clang-static-analyzer-3.8'
})
示例10: test_SingleBuildWithoutUrl
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_SingleBuildWithoutUrl(self):
helper = TestHelper(self, workspace='ws')
factory = helper.factory
helper.add_input_json_file('actions.json', {
'builds': [
{
'title': 'My title',
'url': None,
'desc': None,
'result': 'SUCCESS'
}
]
})
do_post_build(factory, 'actions.json', 'message.json')
helper.assertOutputJsonFile('ws/build/message.json', {
'url': None,
'message': None
})
示例11: test_FailedSingleBuild
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_FailedSingleBuild(self):
helper = TestHelper(self, workspace='ws')
factory = helper.factory
helper.add_input_json_file('actions.json', {
'builds': [
{
'url': 'http://my_build',
'desc': None,
'result': 'FAILURE',
'reason': 'Failure reason'
}
]
})
do_post_build(factory, 'actions.json', 'message.json')
helper.assertOutputJsonFile('ws/build/message.json', {
'url': 'http://my_build',
'message': 'Failure reason'
})
示例12: TestStatusReporterJson
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
class TestStatusReporterJson(unittest.TestCase):
def setUp(self):
env = {
'STATUS_FILE': 'logs/status.json'
}
self.helper = TestHelper(self, workspace='ws', env=env)
def test_Success(self):
with self.helper.factory.status_reporter as status_reporter:
self.assertFalse(status_reporter.failed)
self.assertFalse(status_reporter.failed)
self.helper.assertConsoleOutput('')
self.helper.assertOutputJsonFile('ws/logs/status.json', {
'result': 'SUCCESS',
'reason': None
})
def test_Failure(self):
with self.helper.factory.status_reporter as status_reporter:
status_reporter.mark_failed('Failure reason')
self.helper.executor.exit.assert_called_with(1)
self.helper.assertConsoleOutput("""\
Build FAILED:
Failure reason
""")
self.helper.assertOutputJsonFile('ws/logs/status.json', {
'result': 'FAILURE',
'reason': 'Failure reason'
})
def test_Unstable(self):
with self.helper.factory.status_reporter as status_reporter:
status_reporter.mark_unstable('Unstable reason')
self.assertFalse(self.helper.executor.exit.called)
self.helper.assertConsoleOutput("""\
FAILED: Unstable reason
Build FAILED:
Unstable reason
""")
self.helper.assertOutputJsonFile('ws/logs/status.json', {
'result': 'UNSTABLE',
'reason': 'Unstable reason'
})
def test_Aborted(self):
with self.helper.factory.status_reporter as status_reporter:
raise AbortError(143)
self.assertFalse(status_reporter.failed)
self.helper.executor.exit.assert_called_with(143)
self.helper.assertConsoleOutput('')
self.helper.assertOutputJsonFile('ws/logs/status.json', {
'result': 'ABORTED',
'reason': None
})
示例13: test_CoverageRequest
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_CoverageRequest(self):
helper = TestHelper(self, workspace='ws', env={
'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Coverage')
})
factory = helper.factory
executor = helper.executor
get_actions_from_triggering_comment(factory, 'actions.json')
helper.assertOutputJsonFile('ws/build/actions.json', {
'builds': [
{
'type': 'coverage'
}
]
})
self.assertEqual(executor.method_calls, [
mock.call.ensure_dir_exists('ws/build', ensure_empty=True),
mock.call.write_file('ws/build/actions.json', mock.ANY)
])
示例14: test_PostSubmitRequest
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_PostSubmitRequest(self):
helper = TestHelper(self, workspace='ws', env={
'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Post-submit')
})
input_lines = [
'gcc-4.6 gpu cuda-5.0',
'msvc-2013'
]
helper.add_input_file('ws/gromacs/admin/builds/post-submit-matrix.txt',
'\n'.join(input_lines) + '\n')
factory = helper.factory
executor = helper.executor
get_actions_from_triggering_comment(factory, 'actions.json')
helper.assertOutputJsonFile('ws/build/actions.json', {
'builds': [
{
'type': 'matrix',
'desc': 'post-submit',
'options': '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
}
]
})
示例15: test_CrossVerifyRequestOneBuildOnly
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import assertOutputJsonFile [as 別名]
def test_CrossVerifyRequestOneBuildOnly(self):
helper = TestHelper(self, workspace='ws', env={
'BUILD_URL': 'http://build',
'GERRIT_PROJECT': 'gromacs',
'GERRIT_CHANGE_URL': 'http://gerrit',
'GERRIT_PATCHSET_NUMBER': '3',
'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Cross-verify 1234 quiet clang-analyzer')
})
factory = helper.factory
executor = helper.executor
get_actions_from_triggering_comment(factory, 'actions.json')
helper.assertOutputJsonFile('ws/build/actions.json', {
'builds': [
{
'type': 'clang-analyzer'
}
],
'env': {
'REGRESSIONTESTS_REFSPEC': 'refs/changes/34/1234/5',
'REGRESSIONTESTS_HASH': '1234567890abcdef0123456789abcdef01234567'
}
})