def test_argument_parse_which(fake_cover_project): parser = cover.setup_parser() args = cover.validate(parser, [fake_cover_project]) assert args.commits == 'HEAD' args = cover.validate(parser, ['-w', 'working', fake_cover_project]) assert args.commits == 'HEAD' args = cover.validate(parser, ['-w', 'committed', fake_cover_project]) assert args.commits == 'HEAD^..HEAD' args = cover.validate(parser, ['-w', 'HEAD~5..HEAD~3', fake_cover_project]) assert args.commits == 'HEAD~5..HEAD~3'
def test_validate_no_directory(): parser = cover.setup_parser() with pytest.raises(SystemExit) as excinfo: cover.validate(parser, ['bogus-dir']) assert str(excinfo.value) == '2'
def test_validate_no_coverage_area(fake_project): parser = cover.setup_parser() with pytest.raises(SystemExit) as excinfo: cover.validate(parser, [fake_project]) assert str(excinfo.value) == '2'
def test_validate_directory(fake_cover_project): parser = cover.setup_parser() assert cover.validate(parser, [fake_cover_project])
def test_argument_parse_context(fake_cover_project): parser = cover.setup_parser() args = cover.validate(parser, ['-c', '10', fake_cover_project]) assert args.context == 10