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)
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
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()
def lint(paths, config, logger, fix=False, **lintargs): return perfdocs.run_perfdocs( config, logger=logger, paths=paths, generate=fix )
def lint(paths, config, logger, fix=None, **lintargs): return perfdocs.run_perfdocs(config, logger=logger, paths=paths, verify=True)