From cedc96d3219a4f38d46c42fa7a63ca88e0728b02 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 5 Jan 2019 17:52:32 +0000 Subject: [PATCH 1/3] :sparkles: add reporting feature so that if moban take no action, user would also see it in console log --- moban/main.py | 1 + moban/plugins.py | 2 ++ tests/test_docs.py | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/moban/main.py b/moban/main.py index a453e19b..17e75722 100644 --- a/moban/main.py +++ b/moban/main.py @@ -165,6 +165,7 @@ def handle_command_line(options): options[constants.LABEL_CONFIG], options[constants.LABEL_OUTPUT], ) + engine.report() HASH_STORE.save_hashes() exit_code = reporter.convert_to_shell_exit_code( engine.number_of_templated_files() diff --git a/moban/plugins.py b/moban/plugins.py index 67dbd058..debdb330 100644 --- a/moban/plugins.py +++ b/moban/plugins.py @@ -46,6 +46,7 @@ def number_of_templated_files(self): return self.templated_count def render_to_file(self, template_file, data_file, output_file): + self.file_count = 1 data = self.context.get_data(data_file) template = self.engine.get_template(template_file) template_abs_path = utils.get_template_path( @@ -56,6 +57,7 @@ def render_to_file(self, template_file, data_file, output_file): ) if flag: reporter.report_templating(template_file, output_file) + self.templated_count += 1 def apply_template(self, template_abs_path, template, data, output_file): rendered_content = self.engine.apply_template( diff --git a/tests/test_docs.py b/tests/test_docs.py index 80c8fdc2..74a919e6 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -120,7 +120,10 @@ def _moban(self, folder, expected): def _raw_moban(self, args, folder, expected, output): os.chdir(os.path.join("docs", folder)) with patch.object(sys, "argv", args): - main() + try: + main() + except SystemExit as e: + pass _verify_content(output, expected) os.unlink(output) From db3a52cb299b6bd4f3eb13968d93dcd5ddfe3f70 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 5 Jan 2019 17:59:13 +0000 Subject: [PATCH 2/3] :microscope: verify there is change --- tests/test_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_docs.py b/tests/test_docs.py index 74a919e6..365fc2a4 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -123,7 +123,7 @@ def _raw_moban(self, args, folder, expected, output): try: main() except SystemExit as e: - pass + eq_('1', str(e)) _verify_content(output, expected) os.unlink(output) From 16b9f08165552a735863b6e5c0601e62706083ab Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 5 Jan 2019 17:59:44 +0000 Subject: [PATCH 3/3] :lipstick: update double to single quote --- tests/test_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_docs.py b/tests/test_docs.py index 365fc2a4..1a4470b4 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -123,7 +123,7 @@ def _raw_moban(self, args, folder, expected, output): try: main() except SystemExit as e: - eq_('1', str(e)) + eq_("1", str(e)) _verify_content(output, expected) os.unlink(output)