Example #1
0
def test_perfdocs_bad_paths(structured_logger, config, paths):
    from perfdocs.perfdocs import run_perfdocs

    with pytest.raises(Exception):
        run_perfdocs(config,
                     logger=structured_logger,
                     paths=["bad"],
                     generate=False)
Example #2
0
def test_perfdocs_start_and_fail(verifier, generator, structured_logger, config, paths):
    from perfdocs.perfdocs import run_perfdocs

    with temp_file("bad", content="foo") as temp:
        run_perfdocs(config, logger=structured_logger, paths=[temp], generate=False)
        assert PerfDocsLoggerMock.LOGGER == structured_logger
        assert PerfDocsLoggerMock.PATHS == [temp]
        assert PerfDocsLoggerMock.FAILED

    assert verifier.call_count == 1
    assert mock.call().validate_tree() in verifier.mock_calls
    assert generator.call_count == 0
Example #3
0
def test_perfdocs_start_and_fail(generator, verifier, structured_logger,
                                 config, paths):
    from perfdocs.perfdocs import run_perfdocs

    with temp_file("bad", content="foo") as temp:
        run_perfdocs(config,
                     logger=structured_logger,
                     paths=[temp],
                     generate=False)
        assert PerfDocsLoggerMock.LOGGER == structured_logger
        assert PerfDocsLoggerMock.PATHS == [temp]
        assert PerfDocsLoggerMock.FAILED

    assert verifier.validate_tree.assert_called_once()
    assert generator.generate_perfdocs.assert_not_called()
Example #4
0
def lint(paths, config, logger, fix=False, **lintargs):
    return perfdocs.run_perfdocs(
        config, logger=logger, paths=paths, generate=fix
    )
Example #5
0
def lint(paths, config, logger, fix=None, **lintargs):
    return perfdocs.run_perfdocs(config,
                                 logger=logger,
                                 paths=paths,
                                 verify=True)