Advertisement
Guest User

pylsp-mypy build failure

a guest
Dec 8th, 2023
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.56 KB | None | 0 0
  1. ==> Making package: python-lsp-mypy 0.6.8-1 (Fri 08 Dec 2023 15:58:37 IST)
  2. ==> Retrieving sources...
  3. -> Found pylsp-mypy-0.6.8.tar.gz
  4. ==> Validating source files with sha256sums...
  5. pylsp-mypy-0.6.8.tar.gz ... Passed
  6. ==> Making package: python-lsp-mypy 0.6.8-1 (Fri 08 Dec 2023 15:58:37 IST)
  7. ==> Checking runtime dependencies...
  8. ==> Checking buildtime dependencies...
  9. ==> Retrieving sources...
  10. -> Found pylsp-mypy-0.6.8.tar.gz
  11. ==> Validating source files with sha256sums...
  12. pylsp-mypy-0.6.8.tar.gz ... Passed
  13. ==> Removing existing $srcdir/ directory...
  14. ==> Extracting sources...
  15. -> Extracting pylsp-mypy-0.6.8.tar.gz with bsdtar
  16. ==> Sources are ready.
  17. python-lsp-mypy-0.6.8-1 (python-pylsp-mypy): parsing pkg list...
  18. ==> Making package: python-lsp-mypy 0.6.8-1 (Fri 08 Dec 2023 15:58:39 IST)
  19. ==> Checking runtime dependencies...
  20. ==> Checking buildtime dependencies...
  21. ==> WARNING: Using existing $srcdir/ tree
  22. ==> Removing existing $pkgdir/ directory...
  23. ==> Starting build()...
  24. * Getting build dependencies for wheel...
  25. running egg_info
  26. creating pylsp_mypy.egg-info
  27. writing pylsp_mypy.egg-info/PKG-INFO
  28. writing dependency_links to pylsp_mypy.egg-info/dependency_links.txt
  29. writing entry points to pylsp_mypy.egg-info/entry_points.txt
  30. writing requirements to pylsp_mypy.egg-info/requires.txt
  31. writing top-level names to pylsp_mypy.egg-info/top_level.txt
  32. writing manifest file 'pylsp_mypy.egg-info/SOURCES.txt'
  33. reading manifest file 'pylsp_mypy.egg-info/SOURCES.txt'
  34. reading manifest template 'MANIFEST.in'
  35. adding license file 'LICENSE'
  36. writing manifest file 'pylsp_mypy.egg-info/SOURCES.txt'
  37. * Building wheel...
  38. running bdist_wheel
  39. running build
  40. running build_py
  41. creating build
  42. creating build/lib
  43. creating build/lib/pylsp_mypy
  44. copying pylsp_mypy/__init__.py -> build/lib/pylsp_mypy
  45. copying pylsp_mypy/_version.py -> build/lib/pylsp_mypy
  46. copying pylsp_mypy/plugin.py -> build/lib/pylsp_mypy
  47. installing to build/bdist.linux-x86_64/wheel
  48. running install
  49. running install_lib
  50. creating build/bdist.linux-x86_64
  51. creating build/bdist.linux-x86_64/wheel
  52. creating build/bdist.linux-x86_64/wheel/pylsp_mypy
  53. copying build/lib/pylsp_mypy/__init__.py -> build/bdist.linux-x86_64/wheel/pylsp_mypy
  54. copying build/lib/pylsp_mypy/_version.py -> build/bdist.linux-x86_64/wheel/pylsp_mypy
  55. copying build/lib/pylsp_mypy/plugin.py -> build/bdist.linux-x86_64/wheel/pylsp_mypy
  56. running install_egg_info
  57. running egg_info
  58. writing pylsp_mypy.egg-info/PKG-INFO
  59. writing dependency_links to pylsp_mypy.egg-info/dependency_links.txt
  60. writing entry points to pylsp_mypy.egg-info/entry_points.txt
  61. writing requirements to pylsp_mypy.egg-info/requires.txt
  62. writing top-level names to pylsp_mypy.egg-info/top_level.txt
  63. reading manifest file 'pylsp_mypy.egg-info/SOURCES.txt'
  64. reading manifest template 'MANIFEST.in'
  65. adding license file 'LICENSE'
  66. writing manifest file 'pylsp_mypy.egg-info/SOURCES.txt'
  67. Copying pylsp_mypy.egg-info to build/bdist.linux-x86_64/wheel/pylsp_mypy-0.6.8-py3.11.egg-info
  68. running install_scripts
  69. creating build/bdist.linux-x86_64/wheel/pylsp_mypy-0.6.8.dist-info/WHEEL
  70. creating '/home/emilylime/.cache/paru/clone/python-lsp-mypy/src/pylsp-mypy-0.6.8/dist/.tmp-9z_9us2s/pylsp_mypy-0.6.8-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
  71. adding 'pylsp_mypy/__init__.py'
  72. adding 'pylsp_mypy/_version.py'
  73. adding 'pylsp_mypy/plugin.py'
  74. adding 'pylsp_mypy-0.6.8.dist-info/LICENSE'
  75. adding 'pylsp_mypy-0.6.8.dist-info/METADATA'
  76. adding 'pylsp_mypy-0.6.8.dist-info/WHEEL'
  77. adding 'pylsp_mypy-0.6.8.dist-info/entry_points.txt'
  78. adding 'pylsp_mypy-0.6.8.dist-info/top_level.txt'
  79. adding 'pylsp_mypy-0.6.8.dist-info/RECORD'
  80. removing build/bdist.linux-x86_64/wheel
  81. Successfully built pylsp_mypy-0.6.8-py3-none-any.whl
  82. ==> Starting check()...
  83. ===================================================== test session starts =====================================================
  84. platform linux -- Python 3.11.6, pytest-7.4.3, pluggy-1.3.0
  85. rootdir: /home/emilylime/.cache/paru/clone/python-lsp-mypy/src/pylsp-mypy-0.6.8
  86. collected 19 items
  87.  
  88. test/test_plugin.py .F..F..F..........F [100%]
  89.  
  90. ========================================================== FAILURES ===========================================================
  91. _________________________________________________________ test_plugin _________________________________________________________
  92.  
  93. workspace = <pylsp.workspace.Workspace object at 0x7fc5c80b1a90>
  94. last_diagnostics_monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fc5c739f4d0>
  95.  
  96. def test_plugin(workspace, last_diagnostics_monkeypatch):
  97. doc = Document(DOC_URI, workspace, DOC_TYPE_ERR)
  98. plugin.pylsp_settings(workspace._config)
  99. diags = plugin.pylsp_lint(workspace._config, workspace, doc, is_saved=False)
  100.  
  101. assert len(diags) == 1
  102. diag = diags[0]
  103. > assert re.fullmatch(TYPE_ERR_MSG_REGEX, diag["message"])
  104. E assert None
  105. E + where None = <function fullmatch at 0x7fc5c8c1c040>('"Dict\\[(?:(?:<nothing>)|(?:Never)), (?:(?:<nothing>)|(?:Never))\\]" has no attribute "append"', '"dict[Never, Never]" has no attribute "append"')
  106. E + where <function fullmatch at 0x7fc5c8c1c040> = re.fullmatch
  107.  
  108. test/test_plugin.py:75: AssertionError
  109. __________________________________________________ test_multiple_workspaces ___________________________________________________
  110.  
  111. tmpdir = local('/tmp/pytest-of-emilylime/pytest-3/test_multiple_workspaces0')
  112. last_diagnostics_monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fc5c73f2d90>
  113.  
  114. def test_multiple_workspaces(tmpdir, last_diagnostics_monkeypatch):
  115. DOC_SOURCE = """
  116. def foo():
  117. return
  118. unreachable = 1
  119. """
  120. DOC_ERR_MSG = "Statement is unreachable"
  121.  
  122. # Initialize two workspace folders.
  123. folder1 = tmpdir.mkdir("folder1")
  124. folder2 = tmpdir.mkdir("folder2")
  125.  
  126. # Create configuration file for workspace folder 1.
  127. mypy_config = folder1.join("mypy.ini")
  128. mypy_config.write("[mypy]\nwarn_unreachable = True\ncheck_untyped_defs = True")
  129.  
  130. ws1 = Workspace(uris.from_fs_path(str(folder1)), Mock())
  131. ws1._config = Config(ws1.root_uri, {}, 0, {})
  132. ws2 = Workspace(uris.from_fs_path(str(folder2)), Mock())
  133. ws2._config = Config(ws2.root_uri, {}, 0, {})
  134.  
  135. # Initialize settings for both folders.
  136. plugin.pylsp_settings(ws1._config)
  137. plugin.pylsp_settings(ws2._config)
  138.  
  139. # Test document in workspace 1 (uses mypy.ini configuration).
  140. doc1 = Document(DOC_URI, ws1, DOC_SOURCE)
  141. diags = plugin.pylsp_lint(ws1._config, ws1, doc1, is_saved=False)
  142. assert len(diags) == 1
  143. diag = diags[0]
  144. assert diag["message"] == DOC_ERR_MSG
  145. assert diag["code"] == "unreachable"
  146.  
  147. # Test document in workspace 2 (without mypy.ini configuration)
  148. doc2 = Document(DOC_URI, ws2, DOC_SOURCE)
  149. diags = plugin.pylsp_lint(ws2._config, ws2, doc2, is_saved=False)
  150. > assert len(diags) == 0
  151. E AssertionError: assert 2 == 0
  152. E + where 2 = len([{'code': 'no-untyped-def', 'message': 'Function is missing a return type annotation', 'range': {'end': {'character': ...rn a value', 'range': {'end': {'character': 19, 'line': 3}, 'start': {'character': 0, 'line': 1}}, 'severity': 3, ...}])
  153.  
  154. test/test_plugin.py:140: AssertionError
  155. _________________________________________________ test_option_overrides_dmypy _________________________________________________
  156.  
  157. last_diagnostics_monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fc5c6f10550>
  158. workspace = <pylsp.workspace.Workspace object at 0x7fc5c7396e10>
  159.  
  160. def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
  161. overrides = ["--python-executable", "/tmp/fake", True]
  162. last_diagnostics_monkeypatch.setattr(
  163. FakeConfig,
  164. "plugin_settings",
  165. lambda _, p: {
  166. "overrides": overrides,
  167. "dmypy": True,
  168. "live_mode": False,
  169. }
  170. if p == "pylsp_mypy"
  171. else {},
  172. )
  173.  
  174. m = Mock(wraps=lambda a, **_: Mock(returncode=0, **{"stdout": ""}))
  175. last_diagnostics_monkeypatch.setattr(plugin.subprocess, "run", m)
  176.  
  177. document = Document(DOC_URI, workspace, DOC_TYPE_ERR)
  178.  
  179. config = FakeConfig(uris.to_fs_path(workspace.root_uri))
  180. plugin.pylsp_settings(config)
  181.  
  182. plugin.pylsp_lint(
  183. config=config,
  184. workspace=workspace,
  185. document=document,
  186. is_saved=False,
  187. )
  188. expected = [
  189. "dmypy",
  190. "--status-file",
  191. ".dmypy.json",
  192. "run",
  193. "--",
  194. "--python-executable",
  195. "/tmp/fake",
  196. "--show-error-end",
  197. "--no-error-summary",
  198. document.path,
  199. ]
  200. > m.assert_called_with(expected, capture_output=True, **windows_flag, encoding="utf-8")
  201.  
  202. test/test_plugin.py:234:
  203. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  204.  
  205. self = <Mock id='140487441455760'>
  206. args = (['dmypy', '--status-file', '.dmypy.json', 'run', '--', '--python-executable', ...],)
  207. kwargs = {'capture_output': True, 'encoding': 'utf-8'}
  208. expected = call(['dmypy', '--status-file', '.dmypy.json', 'run', '--', '--python-executable', '/tmp/fake', '--show-error-end', '-...me/.cache/paru/clone/python-lsp-mypy/src/pylsp-mypy-0.6.8/test/test_plugin.py'], capture_output=True, encoding='utf-8')
  209. actual = call(['dmypy', '--status-file', '.dmypy.json', 'run', '--', '--python-executable', '/tmp/fake', '--show-error-end', '-...me/.cache/paru/clone/python-lsp-mypy/src/pylsp-mypy-0.6.8/test/test_plugin.py'], capture_output=True, encoding='utf-8')
  210. _error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7fc5c73d25c0>, cause = None
  211.  
  212. def assert_called_with(self, /, *args, **kwargs):
  213. """assert that the last call was made with the specified arguments.
  214.  
  215. Raises an AssertionError if the args and keyword args passed in are
  216. different to the last call to the mock."""
  217. if self.call_args is None:
  218. expected = self._format_mock_call_signature(args, kwargs)
  219. actual = 'not called.'
  220. error_message = ('expected call not found.\nExpected: %s\nActual: %s'
  221. % (expected, actual))
  222. raise AssertionError(error_message)
  223.  
  224. def _error_message():
  225. msg = self._format_mock_failure_message(args, kwargs)
  226. return msg
  227. expected = self._call_matcher(_Call((args, kwargs), two=True))
  228. actual = self._call_matcher(self.call_args)
  229. if actual != expected:
  230. cause = expected if isinstance(expected, Exception) else None
  231. > raise AssertionError(_error_message()) from cause
  232. E AssertionError: expected call not found.
  233. E Expected: mock(['dmypy', '--status-file', '.dmypy.json', 'run', '--', '--python-executable', '/tmp/fake', '--show-error-end', '--no-error-summary', '//home/emilylime/.cache/paru/clone/python-lsp-mypy/src/pylsp-mypy-0.6.8/test/test_plugin.py'], capture_output=True, encoding='utf-8')
  234. E Actual: mock(['dmypy', '--status-file', '.dmypy.json', 'run', '--', '--python-executable', '/tmp/fake', '--show-error-end', '--no-error-summary', '--config-file', '/home/emilylime/.config/mypy/config', '//home/emilylime/.cache/paru/clone/python-lsp-mypy/src/pylsp-mypy-0.6.8/test/test_plugin.py'], capture_output=True, encoding='utf-8')
  235.  
  236. /usr/lib/python3.11/unittest/mock.py:939: AssertionError
  237. _____________________________________________________ test_config_exclude _____________________________________________________
  238.  
  239. tmpdir = local('/tmp/pytest-of-emilylime/pytest-3/test_config_exclude0')
  240. workspace = <pylsp.workspace.Workspace object at 0x7fc5c73bf390>
  241.  
  242. def test_config_exclude(tmpdir, workspace):
  243. """When exclude is set in config then mypy should not run for that file."""
  244. doc = Document(DOC_URI, workspace, DOC_TYPE_ERR)
  245.  
  246. plugin.pylsp_settings(workspace._config)
  247. workspace.update_config({"pylsp": {"plugins": {"pylsp_mypy": {}}}})
  248. diags = plugin.pylsp_lint(workspace._config, workspace, doc, is_saved=False)
  249. > assert re.search(TYPE_ERR_MSG_REGEX, diags[0]["message"])
  250. E assert None
  251. E + where None = <function search at 0x7fc5c8c1c220>('"Dict\\[(?:(?:<nothing>)|(?:Never)), (?:(?:<nothing>)|(?:Never))\\]" has no attribute "append"', '"dict[Never, Never]" has no attribute "append"')
  252. E + where <function search at 0x7fc5c8c1c220> = re.search
  253.  
  254. test/test_plugin.py:374: AssertionError
  255. =================================================== short test summary info ===================================================
  256. FAILED test/test_plugin.py::test_plugin - assert None
  257. FAILED test/test_plugin.py::test_multiple_workspaces - AssertionError: assert 2 == 0
  258. FAILED test/test_plugin.py::test_option_overrides_dmypy - AssertionError: expected call not found.
  259. FAILED test/test_plugin.py::test_config_exclude - assert None
  260. ================================================ 4 failed, 15 passed in 20.51s ================================================
  261. ==> ERROR: A failure occurred in check().
  262. Aborting...
  263. error: failed to build 'python-lsp-mypy-0.6.8-1 (python-pylsp-mypy)':
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement