You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried the other applicable steps from the Troubleshooting Guide
Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
Probably similarly to 895917a, we have another failing yapf test:
_____________________ test_document_formatting[\r\n-yapf] ______________________
formatter = 'yapf', newline = '\r\n'
completions_codeeditor = (<spyder.plugins.editor.widgets.codeeditor.CodeEditor object at 0x7f2bb160de50>, <spyder.plugins.completion.plugin.CompletionPlugin object at 0x7f2bb15feaf0>)
qtbot = <pytestqt.qtbot.QtBot object at 0x7f2bb13c15e0>
@pytest.mark.slow
@pytest.mark.order(1)
@pytest.mark.parametrize('formatter', [autopep8, yapf, black])
@pytest.mark.parametrize('newline', ['\r\n', '\r', '\n'])
def test_document_formatting(formatter, newline, completions_codeeditor,
qtbot):
"""Validate text autoformatting via autopep8, yapf or black."""
code_editor, completion_plugin = completions_codeeditor
text, expected = get_formatter_values(formatter, newline)
# Set formatter
CONF.set(
'completions',
('provider_configuration', 'lsp', 'values', 'formatting'),
formatter
)
completion_plugin.after_configuration_update([])
qtbot.wait(2000)
# Set text in editor
code_editor.set_text(text)
# Assert eols are the expected ones
assert code_editor.get_line_separator() == newline
# Notify changes
with qtbot.waitSignal(
code_editor.completions_response_signal, timeout=30000):
code_editor.document_did_change()
# Perform formatting
with qtbot.waitSignal(
code_editor.completions_response_signal, timeout=30000):
code_editor.format_document()
# Wait for text to be formatted
qtbot.wait(2000)
> assert code_editor.get_text_with_eol() == expected
E assert ('# -*- coding: utf-8 -*-\r\n'\n '"""\r\n'\n 'Spyder Editor\r\n'\n '\r\n'\n 'This is a temporary script file.\r\n'\n '"""\r\n'\n '\r\n'\n 'import os;import sys\r\n'\n '\r\n'\n '\r\n'\n '# %% functions\r\n'\n 'def d():\r\n'\n ' def inner():return 2\r\n'\n ' return inner\r\n'\n '# ---- func 1 and 2\r\n'\n 'def func1():\r\n'\n ' for i in range(3):\r\n'\n ' print(i)\r\n'\n 'def func2():\r\n'\n ' if True:\r\n'\n ' pass\r\n'\n '# ---- other functions\r\n'\n 'def a():\r\n'\n ' pass\r\n'\n 'def b():\r\n'\n ' pass\r\n'\n 'def c():\r\n'\n ' pass\r\n'\n '\r\n'\n '\r\n'\n '# %% classes\r\n'\n 'class Class1:\r\n'\n ' def __init__(self):\r\n'\n ' super(Class1, self).__init__()\r\n'\n ' self.x = 2\r\n'\n '\r\n'\n ' def method3(self):\r\n'\n ' pass\r\n'\n '\r\n'\n ' def method2(self):\r\n'\n ' pass\r\n'\n '\r\n'\n ' def method1(self):\r\n'\n ' pass\r\n') == ('# -*- coding: utf-8 -*-\r\n'\n '"""\r\n'\n 'Spyder Editor\r\n'\n '\r\n'\n 'This is a temporary script file.\r\n'\n '"""\r\n'\n '\r\n'\n 'import os\r\n'\n 'import sys\r\n'\n '\r\n'\n '\r\n'\n '# %% functions\r\n'\n 'def d():\r\n'\n '\r\n'\n ' def inner():\r\n'\n ' return 2\r\n'\n '\r\n'\n ' return inner\r\n'\n '\r\n'\n '\r\n'\n '# ---- func 1 and 2\r\n'\n 'def func1():\r\n'\n ' for i in range(3):\r\n'\n ' print(i)\r\n'\n '\r\n'\n '\r\n'\n 'def func2():\r\n'\n ' if True:\r\n'\n ' pass\r\n'\n '\r\n'\n '\r\n'\n '# ---- other functions\r\n'\n 'def a():\r\n'\n ' pass\r\n'\n '\r\n'\n '\r\n'\n 'def b():\r\n'\n ' pass\r\n'\n '\r\n'\n '\r\n'\n 'def c():\r\n'\n ' pass\r\n'\n '\r\n'\n '\r\n'\n '# %% classes\r\n'\n 'class Class1:\r\n'\n '\r\n'\n ' def __init__(self):\r\n'\n ' super(Class1, self).__init__()\r\n'\n ' self.x = 2\r\n'\n '\r\n'\n ' def method3(self):\r\n'\n ' pass\r\n'\n '\r\n'\n ' def method2(self):\r\n'\n ' pass\r\n'\n '\r\n'\n ' def method1(self):\r\n'\n ' pass\r\n')
E # -*- coding: utf-8 -*-
E """
E Spyder Editor
E
E This is a temporary script file.
E """
E
E + import os;import sys
E - import os
E - import sys
E
E
E # %% functions
E def d():
E -
E - def inner():
E + def inner():return 2
E ? ++++++++
E - return 2
E -
E return inner
E -
E -
E # ---- func 1 and 2
E def func1():
E for i in range(3):
E print(i)
E -
E -
E def func2():
E if True:
E pass
E -
E -
E # ---- other functions
E def a():
E pass
E -
E -
E def b():
E pass
E -
E -
E def c():
E pass
E
E
E # %% classes
E class Class1:
E -
E def __init__(self):
E super(Class1, self).__init__()
E self.x = 2
E
E def method3(self):
E pass
E
E def method2(self):
E pass
E
E def method1(self):
E pass
spyder/plugins/editor/widgets/tests/test_formatting.py:115: AssertionError
Hmm, I just tested 6.0.0a1, and the yapf tests are still failing, also with the new spyder/plugins/editor/widgets/codeeditor/tests/test_formatting.py::test_document_formatting. This is utterly bizarre, as your CI logs show a very similar environment to ours; we're also using PyLSP 1.7.4.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
Probably similarly to 895917a, we have another failing yapf test:
and similarly for the other two line endings.
Versions
Dependencies
The text was updated successfully, but these errors were encountered: