diff --git a/spyder/plugins/editor/tests/test_plugin.py b/spyder/plugins/editor/tests/test_plugin.py index 59123b524cc..040f93592d7 100644 --- a/spyder/plugins/editor/tests/test_plugin.py +++ b/spyder/plugins/editor/tests/test_plugin.py @@ -136,19 +136,36 @@ def test_renamed_tree(editor_plugin, mocker): editor = editor_plugin mocker.patch.object(editor, 'get_filenames') mocker.patch.object(editor, 'renamed') - editor.get_filenames.return_value = ['/test/directory/file1.py', - '/test/directory/file2.txt', - '/home/spyder/testing/file3.py', - '/test/directory/file4.rst'] - - editor.renamed_tree('/test/directory', '/test/dir') + if os.name == "nt": + filenames = [r'C:\test\directory\file1.py', + r'C:\test\directory\file2.txt', + r'C:\home\spyder\testing\file3.py', + r'C:\test\directory\file4.rst'] + expected = [r'C:\test\dir\file1.py', + r'C:\test\dir\file2.txt', + r'C:\home\spyder\testing\file3.py', + r'C:\test\dir\file4.rst'] + sourcedir = r'C:\test\directory' + destdir = r'C:\test\dir' + else: + filenames = ['/test/directory/file1.py', + '/test/directory/file2.txt', + '/home/spyder/testing/file3.py', + '/test/directory/file4.rst'] + expected = ['/test/dir/file1.py', + '/test/dir/file2.txt', + '/home/spyder/testing/file3.py', + '/test/dir/file4.rst'] + sourcedir = '/test/directory' + destdir = '/test/dir' + + editor.get_filenames.return_value = filenames + + editor.renamed_tree(sourcedir, destdir) assert editor.renamed.call_count == 3 - assert editor.renamed.called_with(source='/test/directory/file1.py', - dest='test/dir/file1.py') - assert editor.renamed.called_with(source='/test/directory/file2.txt', - dest='test/dir/file2.txt') - assert editor.renamed.called_with(source='/test/directory/file4.rst', - dest='test/dir/file4.rst') + for file in [0, 1, 3]: + editor.renamed.assert_any_call(source=filenames[file], + dest=expected[file]) def test_no_template(editor_plugin): diff --git a/spyder/plugins/editor/widgets/tests/test_warnings.py b/spyder/plugins/editor/widgets/tests/test_warnings.py index 663bbf55fc5..2a57e7a7af9 100644 --- a/spyder/plugins/editor/widgets/tests/test_warnings.py +++ b/spyder/plugins/editor/widgets/tests/test_warnings.py @@ -263,7 +263,12 @@ def test_update_warnings_after_closequotes(qtbot, completions_codeeditor_linting editor, _ = completions_codeeditor_linting editor.textCursor().insertText("print('test)\n") - if sys.version_info >= (3, 10): + if sys.version_info >= (3, 12): + expected = [ + ['unterminated string literal (detected at line 1)', 1], + ['E901 TokenError: unterminated string literal (detected at line 1)', 1] + ] + elif sys.version_info >= (3, 10): expected = [['unterminated string literal (detected at line 1)', 1]] else: expected = [['EOL while scanning string literal', 1]] @@ -302,7 +307,12 @@ def test_update_warnings_after_closebrackets(qtbot, completions_codeeditor_linti editor, _ = completions_codeeditor_linting editor.textCursor().insertText("print('test'\n") - if sys.version_info >= (3, 10): + if sys.version_info >= (3, 12): + expected = [ + ["'(' was never closed", 1], + ['E901 TokenError: unexpected EOF in multi-line statement', 1] + ] + elif sys.version_info >= (3, 10): expected = [ ["'(' was never closed", 1], ['E901 TokenError: EOF in multi-line statement', 2] diff --git a/spyder/plugins/variableexplorer/widgets/objectexplorer/tests/test_objectexplorer.py b/spyder/plugins/variableexplorer/widgets/objectexplorer/tests/test_objectexplorer.py index 06d03bc484e..d80fdb87397 100644 --- a/spyder/plugins/variableexplorer/widgets/objectexplorer/tests/test_objectexplorer.py +++ b/spyder/plugins/variableexplorer/widgets/objectexplorer/tests/test_objectexplorer.py @@ -110,7 +110,7 @@ def error_attribute(self): ([1, 3, 4, 'kjkj', None], [45, 48]), ({1, 2, 1, 3, None, 'A', 'B', 'C', True, False}, [54, 57]), (1.2233, [57, 59]), - (np.random.rand(10, 10), [166, 162]), + (np.random.rand(10, 10), [162, 167]), (datetime.date(1945, 5, 8), [43, 48]) ]) def test_objectexplorer_collection_types(objectexplorer, params): diff --git a/spyder/widgets/tests/test_reporterror.py b/spyder/widgets/tests/test_reporterror.py index 67647d410bc..0f81d1847f6 100644 --- a/spyder/widgets/tests/test_reporterror.py +++ b/spyder/widgets/tests/test_reporterror.py @@ -95,7 +95,6 @@ def test_report_issue_url(monkeypatch): target_url_base = __project_url__ + '/issues/new' MockQDesktopServices = MagicMock() - mockQDesktopServices_instance = MockQDesktopServices() attr_to_patch = ('spyder.widgets.reporterror.QDesktopServices') monkeypatch.setattr(attr_to_patch, MockQDesktopServices) @@ -103,14 +102,14 @@ def test_report_issue_url(monkeypatch): target_url = QUrl(target_url_base + '?body=' + body) SpyderErrorDialog.open_web_report(body=body, title=None) assert MockQDesktopServices.openUrl.call_count == 1 - mockQDesktopServices_instance.openUrl.called_with(target_url) + MockQDesktopServices.openUrl.assert_called_with(target_url) # Test when body != None and title != None target_url = QUrl(target_url_base + '?body=' + body + "&title=" + title) - SpyderErrorDialog.open_web_report(body=body, title=None) + SpyderErrorDialog.open_web_report(body=body, title=title) assert MockQDesktopServices.openUrl.call_count == 2 - mockQDesktopServices_instance.openUrl.called_with(target_url) + MockQDesktopServices.openUrl.assert_called_with(target_url) def test_render_issue():