From 09cc7d3272f334d1e32bf931cd19283568926167 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Tue, 5 Sep 2017 19:24:31 +0100 Subject: [PATCH] Changed pydoc's output to not show an absolute path. - The absolute path was causing tools_test.py to fail within test_distributions.py. --- tests/golden-files/results/pydoc-hi3_py | 24 ++++++++++++------------ tests/golden-files/results/pydoc-hi_py | 24 ++++++++++++------------ tests/tools_test.py | 6 +----- vigil/tools.py | 1 + 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/tests/golden-files/results/pydoc-hi3_py b/tests/golden-files/results/pydoc-hi3_py index 987cf08..38bdadc 100644 --- a/tests/golden-files/results/pydoc-hi3_py +++ b/tests/golden-files/results/pydoc-hi3_py @@ -1,12 +1,12 @@ -Help on module hi3: - -NAME - hi3 - -FUNCTIONS - hi() - -FILE - /CWD/input/hi3.py - - \ No newline at end of file +Help on module hi3: + +NAME + hi3 + +FUNCTIONS + hi() + +FILE + input/hi3.py + + \ No newline at end of file diff --git a/tests/golden-files/results/pydoc-hi_py b/tests/golden-files/results/pydoc-hi_py index a51c85f..304ded2 100644 --- a/tests/golden-files/results/pydoc-hi_py +++ b/tests/golden-files/results/pydoc-hi_py @@ -1,12 +1,12 @@ -Help on module hi: - -NAME - hi - -FILE - /CWD/input/hi.py - -FUNCTIONS - hi() - - \ No newline at end of file +Help on module hi: + +NAME + hi + +FILE + input/hi.py + +FUNCTIONS + hi() + + \ No newline at end of file diff --git a/tests/tools_test.py b/tests/tools_test.py index 305b11b..e8a6dcd 100755 --- a/tests/tools_test.py +++ b/tests/tools_test.py @@ -62,11 +62,7 @@ class ToolsTestCase(unittest.TestCase): with self.subTest(input_filename=input_filename): status, result = run_tool(tool, input_filename) golden_path = result_path(tool, input_filename) - text = widget_to_string(result) - with chdir(os.path.join(VIGIL_ROOT, "golden-files")): - cwd = os.getcwd() - text = text.replace(cwd, "/CWD") - golden.assertGolden(text, golden_path) + golden.assertGolden(widget_to_string(result), golden_path) self.assertEqual(status, expected_status) def test_metadata(self): diff --git a/vigil/tools.py b/vigil/tools.py index 805deea..7827659 100644 --- a/vigil/tools.py +++ b/vigil/tools.py @@ -346,6 +346,7 @@ def pydoc(path): status = Status.normal if returncode == 0 else Status.not_applicable if not stdout.startswith("Help on module"): status = Status.not_applicable + stdout = stdout.replace(os.getcwd() + "/", "") return status, fill3.Text(_fix_input(stdout))