def test_param_broken_cfg(testdir, content):
'''verifies pytest-github loads completed info from provided --github-cfg parameter'''
# create github.yml config for testing
with mock.patch('os.path.isfile', return_value=True) as mock_isfile:
with mock.patch('pytest_github.plugin.open', mock.mock_open(read_data=content), create=True) as mock_open:
with mock.patch('pytest_github.plugin.GitHubPytestPlugin') as mock_plugin:
result = testdir.runpytest()
# Assert py.test exit code
assert result.ret == EXIT_NOTESTSCOLLECTED
# Assert mock isfile called
mock_isfile.assert_called_once_with('github.yml')
# Assert mock open called on provided file
mock_open.assert_called_once_with('github.yml', 'r')
# Assert plugin initialized as expected
mock_plugin.assert_called_once_with(None, None, completed_labels=[])
评论列表
文章目录