diff --git a/doc/build/changelog/unreleased_14/mypy_fixes.rst b/doc/build/changelog/unreleased_14/mypy_fixes.rst new file mode 100644 index 0000000000..32e4f14658 --- /dev/null +++ b/doc/build/changelog/unreleased_14/mypy_fixes.rst @@ -0,0 +1,9 @@ +.. change:: + :tags: bug, tests + + Adjusted the test suite which tests the Mypy plugin to accommodate for + changes in Mypy 0.990 regarding how it handles message output, which affect + how sys.path is interpreted when determining if notes and errors should be + printed for particular files. The change broke the test suite as the files + within the test directory itself no longer produced messaging when run + under the mypy API. diff --git a/test/ext/mypy/test_mypy_plugin_py3k.py b/test/ext/mypy/test_mypy_plugin_py3k.py index 181a7958f3..3df758c56d 100644 --- a/test/ext/mypy/test_mypy_plugin_py3k.py +++ b/test/ext/mypy/test_mypy_plugin_py3k.py @@ -63,7 +63,18 @@ class MypyPluginTest(fixtures.TestBase): ), ] - args.append(path) + if incremental: + args.append(path) + else: + # mypy as of 0.990 is more aggressively blocking messaging + # for paths that are in sys.path, and as pytest puts currdir, + # test/ etc in sys.path, just copy the source file to the + # tempdir we are working in so that we don't have to try to + # manipulate sys.path and/or guess what mypy is doing + filename = os.path.basename(path) + test_program = os.path.join(cachedir, filename) + shutil.copyfile(path, test_program) + args.append(test_program) result = api.run(args) return result @@ -185,7 +196,9 @@ class MypyPluginTest(fixtures.TestBase): not_located = [] if expected_errors: - eq_(result[2], 1, msg=result) + # mypy 0.990 changed how return codes work, so don't assume a + # 1 or a 0 return code here, could be either depending on if + # errors were generated or not print(result[0])