From d78de02926673eea2a8619073ba308628675c78f Mon Sep 17 00:00:00 2001 From: carlosperate Date: Tue, 19 Jun 2018 20:09:01 +0100 Subject: [PATCH 1/4] makep.py: Check for return codes --- make.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/make.py b/make.py index 2bdbd07ed..0d50888e0 100644 --- a/make.py +++ b/make.py @@ -166,10 +166,17 @@ def check(): """Run all the checkers and tests """ print("\nCheck") - clean() - pyflakes() - pycodestyle() - coverage() + funcs = [ + clean, + pyflakes, + pycodestyle, + coverage + ] + for func in funcs: + return_code = func() + if return_code != 0: + return return_code + return 0 @export @@ -185,6 +192,7 @@ def clean(): _rmtree("lib") _rmtree("pynsist_pkgs") _rmfiles(".", "*.pyc") + return 0 @export @@ -226,7 +234,7 @@ def run(): if not os.environ.get("VIRTUAL_ENV"): raise RuntimeError("Cannot run Mu;" "your Python virtualenv is not activated") - subprocess.run(["python", "-m", "mu"]).returncode + return subprocess.run(["python", "-m", "mu"]).returncode @export @@ -235,7 +243,9 @@ def dist(): """ check() print("Checks pass; good to package") - subprocess.run(["python", "setup.py", "sdist", "bdist_wheel"]).returncode + return subprocess.run( + ["python", "setup.py", "sdist", "bdist_wheel"] + ).returncode @export @@ -285,6 +295,8 @@ def docs(): os.chdir("docs") try: return subprocess.run(["cmd", "/c", "make.bat", "html"]).returncode + except Exception: + return 1 finally: os.chdir(cwd) From a35b93ce053806b2ad284de469443d05a74fdd0e Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Mon, 9 Jul 2018 02:02:45 +0100 Subject: [PATCH 2/4] Add missing normcase. --- mu/debugger/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mu/debugger/client.py b/mu/debugger/client.py index 3eb1091c3..fb07c8bbc 100644 --- a/mu/debugger/client.py +++ b/mu/debugger/client.py @@ -232,7 +232,7 @@ def breakpoint(self, breakpoint): try: if isinstance(breakpoint, tuple): filename, line = breakpoint - filename = os.path.abspath(os.path.abspath(filename)) + filename = os.path.normcase(os.path.abspath(filename)) return self.bp_index[filename][line] else: return self.bp_list[breakpoint] From b877e754874c93a72fada4f9f8a2a7a314197cd9 Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Mon, 9 Jul 2018 02:09:12 +0100 Subject: [PATCH 3/4] Ensure tests are OS file path agnostic. --- tests/interface/test_panes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interface/test_panes.py b/tests/interface/test_panes.py index adf9e34b5..b02141ad9 100644 --- a/tests/interface/test_panes.py +++ b/tests/interface/test_panes.py @@ -631,7 +631,7 @@ def test_LocalFileList_contextMenuEvent(): with mock.patch('mu.interface.panes.QMenu', return_value=mock_menu): mfs.contextMenuEvent(mock_event) assert mfs.set_message.emit.call_count == 0 - mock_open.assert_called_once_with('homepath/foo.py') + mock_open.assert_called_once_with(os.path.join('homepath', 'foo.py')) def test_LocalFileList_contextMenuEvent_external(): From 37689f4f1426b0b565f04dbf21fa33a523d10bd2 Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Mon, 9 Jul 2018 02:19:38 +0100 Subject: [PATCH 4/4] Make LC_ALL based test unix only. --- tests/test_init.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_init.py b/tests/test_init.py index 170d15b6d..e512fb93e 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -3,6 +3,7 @@ Tests for the module __init__ file. """ import os +import sys import importlib from unittest import mock @@ -14,6 +15,9 @@ def test_gettext_translation(): Test the right translation is set based on the LC_ALL environmental variable. """ + if sys.platform == 'win32': + # Unix only test. + return old_lc_all = os.environ.get('LC_ALL', None) os.environ['LC_ALL'] = 'es_ES.UTF-8'