Пример #1
0
def test_writes_summary_svg():
    plugin = Profiling(True)
    plugin.profs = [sentinel.prof]
    terminalreporter = Mock()
    with patch('pstats.Stats'):
        with patch('pipes.Template'):
            plugin.pytest_sessionfinish(Mock(), Mock())
        plugin.pytest_terminal_summary(terminalreporter)
    assert 'SVG' in terminalreporter.write.call_args[0][0]
Пример #2
0
def test_writes_summary():
    plugin = Profiling(False)
    plugin.profs = [sentinel.prof]
    terminalreporter, stats = Mock(), Mock()
    with patch('pstats.Stats', return_value=stats) as Stats:
        plugin.pytest_sessionfinish(Mock(), Mock())
        plugin.pytest_terminal_summary(terminalreporter)
    assert 'Profiling' in terminalreporter.write.call_args[0][0]
    assert Stats.called_with(stats, stream=terminalreporter)