Skip to content

Commit 26fe54e

Browse files
committed
Comply with the --no-file argument.
This patch fixes #142. Indeed, before this patch, the `--no-file` argument was not respected in regard with the percentage file. This patch fixes that. Please keep in mind that other highly wanted files (like the .running one) are still systematically generated. Contributors: * @spirillen
1 parent b38c39b commit 26fe54e

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

PyFunceble/cli/system/launcher.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -482,36 +482,37 @@ def generate_percentage_file(parent_dirname: str) -> None:
482482
Generates the percentage file.
483483
"""
484484

485-
self.counter.set_parent_dirname(parent_dirname)
486-
487-
destination = os.path.join(
488-
self.counter.get_output_basedir(),
489-
PyFunceble.cli.storage.OUTPUTS.logs.directories.parent,
490-
PyFunceble.cli.storage.OUTPUTS.logs.directories.percentage,
491-
PyFunceble.cli.storage.OUTPUTS.logs.filenames.percentage,
492-
)
485+
if not PyFunceble.storage.CONFIGURATION.cli_testing.file_generation.no_file:
486+
self.counter.set_parent_dirname(parent_dirname)
487+
488+
destination = os.path.join(
489+
self.counter.get_output_basedir(),
490+
PyFunceble.cli.storage.OUTPUTS.logs.directories.parent,
491+
PyFunceble.cli.storage.OUTPUTS.logs.directories.percentage,
492+
PyFunceble.cli.storage.OUTPUTS.logs.filenames.percentage,
493+
)
493494

494-
stdout_header_printed = False
495+
stdout_header_printed = False
495496

496-
self.stdout_printer.template_to_use = "percentage"
497-
self.file_printer.template_to_use = "percentage"
498-
self.file_printer.destination = destination
497+
self.stdout_printer.template_to_use = "percentage"
498+
self.file_printer.template_to_use = "percentage"
499+
self.file_printer.destination = destination
499500

500-
for data in self.counter.get_dataset_for_printer():
501-
self.file_printer.set_dataset(data).print_interpolated_line()
501+
for data in self.counter.get_dataset_for_printer():
502+
self.file_printer.set_dataset(data).print_interpolated_line()
502503

503-
# pylint: disable=line-too-long
504-
if (
505-
PyFunceble.storage.CONFIGURATION.cli_testing.display_mode.percentage
506-
and not PyFunceble.storage.CONFIGURATION.cli_testing.display_mode.quiet
507-
):
508-
self.stdout_printer.dataset = data
504+
# pylint: disable=line-too-long
505+
if (
506+
PyFunceble.storage.CONFIGURATION.cli_testing.display_mode.percentage
507+
and not PyFunceble.storage.CONFIGURATION.cli_testing.display_mode.quiet
508+
):
509+
self.stdout_printer.dataset = data
509510

510-
if not stdout_header_printed:
511-
self.stdout_printer.print_header()
512-
stdout_header_printed = True
511+
if not stdout_header_printed:
512+
self.stdout_printer.print_header()
513+
stdout_header_printed = True
513514

514-
self.stdout_printer.print_interpolated_line()
515+
self.stdout_printer.print_interpolated_line()
515516

516517
for protocol in self.testing_protocol:
517518
if protocol["destination"]:

PyFunceble/cli/threads/producer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ def run_counter(self, test_dataset: dict, test_result: CheckerStatusBase) -> Non
232232
The test result object.
233233
"""
234234

235-
if not self.block_printer and test_dataset["destination"]:
235+
if (
236+
not self.block_printer
237+
and test_dataset["destination"]
238+
and not PyFunceble.storage.CONFIGURATION.cli_testing.file_generation.no_file
239+
):
236240
# Note: We don't want hiden data to be counted.
237241

238242
self.counter.set_parent_dirname(test_dataset["destination"]).count(

0 commit comments

Comments
 (0)