How to use the flaky.flaky_pytest_plugin.PLUGIN function in flaky

To help you get started, we’ve selected a few flaky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github box / flaky / test / test_pytest / test_flaky_pytest_plugin.py View on Github external
def test_flaky_xdist_nodedown(
        mock_xdist_node_workeroutput,
        assign_workeroutput,
        mock_xdist_error
):
    flaky_xdist = FlakyXdist(PLUGIN)
    node = Mock()
    if assign_workeroutput:
        node.workeroutput = mock_xdist_node_workeroutput
    else:
        delattr(node, 'workeroutput')
        delattr(node, 'slaveoutput')
    mock_stream = Mock(StringIO)
    with patch.object(PLUGIN, '_stream', mock_stream):
        flaky_xdist.pytest_testnodedown(node, mock_xdist_error)
    if assign_workeroutput and 'flaky_report' in mock_xdist_node_workeroutput:
        mock_stream.write.assert_called_once_with(
            mock_xdist_node_workeroutput['flaky_report'],
        )
    else:
        assert not mock_stream.write.called