diff --git a/potodo/potodo.py b/potodo/potodo.py index 379df85..3ed95f7 100644 --- a/potodo/potodo.py +++ b/potodo/potodo.py @@ -35,8 +35,9 @@ def print_dir_stats( # placed it means it doesnt need to be printed folder_completion = 100 * folder_stats["translated"] / folder_stats["total"] - - print(f"\n\n# {directory_name} ({folder_completion:.2f}% done)\n") + print( + f"\n\n# {directory_name} {folder_stats['translated']:3d} / {folder_stats['total']:3d} ({folder_completion:5.1f}% translated)\n" + ) print("\n".join(buffer)) logging.debug("Not printing directory %s", directory_name) @@ -55,6 +56,9 @@ def add_dir_stats( dict( name=f"{directory_name}/", percent_translated=float(f"{folder_completion:.2f}"), + entries=sum(file["entries"] for file in buffer), + fuzzies=sum(file["fuzzies"] for file in buffer), + translated=sum(file["translated"] for file in buffer), files=buffer, ) ) @@ -139,7 +143,7 @@ def non_interactive_output( else: if total_entries != 0: total_completion = 100 * total_translated / total_entries - print(f"\n\n# TOTAL ({total_completion:.2f}% done)\n") + print(f"\n\n# TOTAL ({total_completion:.2f}% translated)\n") def exec_potodo( diff --git a/tests/test_potodo.py b/tests/test_potodo.py index 631e397..416003c 100644 --- a/tests/test_potodo.py +++ b/tests/test_potodo.py @@ -29,6 +29,7 @@ def test_txt_output(capsys): exec_potodo(json_format=False, **config) captured = capsys.readouterr() + assert "# repository" in captured.out assert "file1.po" in captured.out assert "file2.po" in captured.out assert "# folder" in captured.out @@ -36,6 +37,7 @@ def test_txt_output(capsys): assert "1 fuzzy" in captured.out assert "2 fuzzy" not in captured.out assert "excluded" not in captured.out + assert "# TOTAL" in captured.out def test_output(capsys): @@ -46,6 +48,9 @@ def test_output(capsys): { "name": "folder/", "percent_translated": 0.0, + "entries": 1, + "fuzzies": 0, + "translated": 0, "files": [ { "name": "folder/file3", @@ -62,6 +67,9 @@ def test_output(capsys): { "name": f"{REPO_DIR}/", "percent_translated": 25.0, + "entries": 4, + "fuzzies": 1, + "translated": 1, "files": [ { "name": f"{REPO_DIR}/file1", diff --git a/tests/test_potodo_default_args.py b/tests/test_potodo_default_args.py index 8c2f3bb..87934f7 100644 --- a/tests/test_potodo_default_args.py +++ b/tests/test_potodo_default_args.py @@ -30,15 +30,15 @@ class TestPotodoCLI: def test_potodo_no_args(self): output = check_output([sys.executable, "-m", "potodo"]).decode("utf-8") - assert "# excluded (50.00% done)" in output - assert "# folder (33.33% done)" in output + assert "# excluded 1 / 2 (50.00% translated)" in output + assert "# folder 1 / 3 (33.33% translated)" in output assert ( "- excluded.po 1 / 2 ( 50.0% translated)" in output ) assert ( "- file3.po 0 / 1 ( 0.0% translated)" in output ) - assert "# repository (25.00% done)" in output + assert "# repository 1 / 4 (25.00% translated)" in output assert ( "- file1.po 1 / 3 ( 33.0% translated), 1 fuzzy" in output @@ -59,12 +59,12 @@ def test_potodo_exclude(self): [sys.executable, "-m", "potodo", "-e", self.excluded_1, self.excluded_2] ).decode("utf-8") assert output == output_short - assert "# excluded (50.00% done)" not in output + assert "# excluded 1 / 2 (50.00% translated)" in output assert ( "- excluded.po 1 / 2 ( 50.0% translated)" not in output ) - assert "# repository (25.00% done)" in output + assert "# repository 1 / 4 (25.00% translated)" in output assert ( "- file1.po 1 / 3 ( 33.0% translated), 1 fuzzy" in output @@ -133,7 +133,7 @@ def test_potodo_counts(self): not in output ) assert "- file4.po 1 to do" in output - assert "# repository (25.00% done)" in output + assert "# repository 1 / 4 (25.00% translated)" in output assert ( "- file1.po 2 to do, including 1 fuzzies." in output )