Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Tests
on:
push:
branches: [main]
pull_request_target:
branches: [main]
pull_request:
branches: [ main ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion src/robocop/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def list_commands(self, ctx: typer.Context) -> list[str]: # noqa: ARG002
cache_option = Annotated[
bool,
typer.Option(
"--cache",
"--cache/--no-cache",
help="Disable file caching. All files will be processed regardless of modifications.",
rich_help_panel="Caching",
),
Expand Down
2 changes: 1 addition & 1 deletion tests/formatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def run_tidy(
overwrite=True,
check=not_modified,
output=output_path,
no_cache=True,
cache=False,
**kwargs,
)
if exit_code is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/linter/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def check_rule( # noqa: PLR0915
test_fn = check_project
else:
test_fn = check_files
kwargs["no_cache"] = True
kwargs["cache"] = False
test_data = test_dir or self.test_class_dir
sort_lines = output_format == "simple"
issue_format = self.get_issue_format(issue_format)
Expand Down
14 changes: 6 additions & 8 deletions tests/performance/generate_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def formatter_report(formatter: str, report_name: str, cache: bool = True) -> in
main_dir = Path(__file__).parent.parent.parent
formatter_dir = main_dir / "tests" / "formatter" / "formatters" / formatter
with working_directory(formatter_dir):
format_files(
["source"], select=[formatter], overwrite=False, return_result=True, silent=True, no_cache=not cache
)
format_files(["source"], select=[formatter], overwrite=False, return_result=True, silent=True, cache=cache)
source_dir = formatter_dir / "source"
return len(list(source_dir.iterdir()))

Expand All @@ -114,7 +112,7 @@ def linter_report(report_name: str, **kwargs) -> int: # noqa: ARG001
@performance_report(runs=2)
def lint_large_file(report_name: str, lint_dir: Path, **kwargs) -> int: # noqa: ARG001
with working_directory(lint_dir):
check_files(return_result=True, select=["ALL"], no_cache=True, **kwargs)
check_files(return_result=True, select=["ALL"], cache=False, **kwargs)
return 1


Expand Down Expand Up @@ -142,10 +140,10 @@ def generate_large_file(template_path: Path, output_dir: Path) -> None:
# So we can generate reports for multiple past versions. It is important since the actual seconds change depending
# on where we run the script from, but the % change between version should be comparable. Also we can use new tests
# on old versions
linter_report(report_name="with_print_cache", no_cache=False)
linter_report(report_name="with_print_no_cache", no_cache=True)
linter_report(report_name="without_print_cache", silent=True, no_cache=False)
linter_report(report_name="without_print_no_cache", silent=True, no_cache=True)
linter_report(report_name="with_print_cache", cache=True)
linter_report(report_name="with_print_no_cache", cache=False)
linter_report(report_name="without_print_cache", silent=True, cache=True)
linter_report(report_name="without_print_no_cache", silent=True, cache=False)
for formatter in FORMATTERS:
formatter_report(formatter=formatter, report_name=formatter)
formatter_report(formatter=formatter, report_name=f"{formatter}_no_cache", cache=False)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def test_reports_with_silent(self, tmp_path):
],
)
def test_check_exit_code(self, check, will_format, expected_exit_code):
# Arrange
test_data = Path(__file__).parent / "formatter" / "formatters" / "NormalizeSeparators"
if will_format:
test_data = test_data / "source"
Expand All @@ -132,8 +133,10 @@ def test_check_exit_code(self, check, will_format, expected_exit_code):
command = ["format", "--select", "NormalizeSeparators", "--no-overwrite", "--no-cache"]
if check:
command += ["--check"]
# Act
with working_directory(test_data):
result = CliRunner().invoke(app, [*command, "test.robot"])
# Assert
assert result.exit_code == expected_exit_code

@pytest.mark.parametrize(
Expand Down
Loading