diff --git a/rope/base/ast.py b/rope/base/ast.py index afdeb95f5..cb7f281c2 100644 --- a/rope/base/ast.py +++ b/rope/base/ast.py @@ -1,5 +1,5 @@ -import ast -from ast import * +import ast # noqu +from ast import * # noqa from rope.base import fscommands diff --git a/rope/base/fscommands.py b/rope/base/fscommands.py index f69b172e7..85d7a2396 100644 --- a/rope/base/fscommands.py +++ b/rope/base/fscommands.py @@ -10,8 +10,6 @@ import os import shutil import subprocess - -import rope.base.utils.pycompat as pycompat import typing diff --git a/rope/base/oi/soa.py b/rope/base/oi/soa.py index 4e8cab4a8..928e28f1b 100644 --- a/rope/base/oi/soa.py +++ b/rope/base/oi/soa.py @@ -30,9 +30,7 @@ def _follow(pyfunction): pycore, pyfunction, return_true, return_false, new_followed_calls ) - if not followed_calls: - _follow = None - visitor = SOAVisitor(pycore, pydefined, _follow) + visitor = SOAVisitor(pycore, pydefined, _follow if followed_calls else None) for child in rope.base.ast.get_child_nodes(pydefined.get_ast()): rope.base.ast.walk(child, visitor) diff --git a/rope/base/oi/type_hinting/evaluate.py b/rope/base/oi/type_hinting/evaluate.py index 59c578b06..7dabc00c2 100644 --- a/rope/base/oi/type_hinting/evaluate.py +++ b/rope/base/oi/type_hinting/evaluate.py @@ -1,7 +1,6 @@ # Based on super lightweight Simple Top-Down Parser from http://effbot.org/zone/simple-top-down-parsing.htm # and https://bitbucket.org/emacsway/sqlbuilder/src/default/sqlbuilder/smartsql/contrib/evaluate.py import re -from rope.base.utils import pycompat from rope.base.oi.type_hinting import utils from rope.base import utils as base_utils @@ -268,7 +267,7 @@ def led(self, left, parser): @method(symbol("[")) -def evaluate(self, pyobject): +def evaluate(self, pyobject): # noqa return utils.parametrize_type( self.first.evaluate(pyobject), *[i.evaluate(pyobject) for i in self.second] ) @@ -276,7 +275,7 @@ def evaluate(self, pyobject): # Anonymous Function Calls @method(symbol("(")) -def nud(self, parser): +def nud(self, parser): # noqa self.second = [] if parser.token.name != ")": while 1: @@ -292,7 +291,7 @@ def nud(self, parser): # Function Calls @method(symbol("(")) -def led(self, left, parser): +def led(self, left, parser): # noqa self.first = left self.second = [] if parser.token.name != ")": @@ -308,14 +307,14 @@ def led(self, left, parser): @method(symbol("(")) -def evaluate(self, pyobject): +def evaluate(self, pyobject): # noqa # TODO: Implement me raise NotImplementedError @method(symbol("or")) @method(symbol("|")) -def evaluate(self, pyobject): +def evaluate(self, pyobject): # noqa # TODO: Implement me raise NotImplementedError @@ -355,4 +354,4 @@ def __call__(self, program, pyobject): return ast.evaluate(pyobject) -evaluate = Evaluator() +evaluate = Evaluator() # noqa diff --git a/rope/base/oi/type_hinting/providers/pep0484_type_comments.py b/rope/base/oi/type_hinting/providers/pep0484_type_comments.py index 243d8bb9f..2a8033ef1 100644 --- a/rope/base/oi/type_hinting/providers/pep0484_type_comments.py +++ b/rope/base/oi/type_hinting/providers/pep0484_type_comments.py @@ -1,5 +1,5 @@ import re -from rope.base.oi.type_hinting import utils + from rope.base.oi.type_hinting.providers import interfaces diff --git a/rope/base/oi/type_hinting/utils.py b/rope/base/oi/type_hinting/utils.py index b59cb6798..a2f90bf8b 100644 --- a/rope/base/oi/type_hinting/utils.py +++ b/rope/base/oi/type_hinting/utils.py @@ -1,14 +1,10 @@ import logging +from typing import Optional, Union -try: - from typing import Union, Optional -except ImportError: - pass import rope.base.utils as base_utils from rope.base import evaluate from rope.base.exceptions import AttributeNotFoundError from rope.base.pyobjects import PyClass, PyDefinedObject, PyFunction, PyObject -from rope.base.utils import pycompat def get_super_func(pyfunc): diff --git a/rope/base/pycore.py b/rope/base/pycore.py index d41aaf117..1ce88ec6d 100644 --- a/rope/base/pycore.py +++ b/rope/base/pycore.py @@ -1,6 +1,5 @@ import bisect import difflib -import sys import warnings import rope.base.libutils @@ -15,7 +14,6 @@ from rope.base import stdmods from rope.base import taskhandle from rope.base import utils -from rope.base.exceptions import ModuleNotFoundError class PyCore: diff --git a/rope/base/pyobjectsdef.py b/rope/base/pyobjectsdef.py index 5f6bf9271..72fd5321f 100644 --- a/rope/base/pyobjectsdef.py +++ b/rope/base/pyobjectsdef.py @@ -1,4 +1,3 @@ -from rope.base.pynames import DefinedName import rope.base.builtins import rope.base.codeanalyze import rope.base.evaluate @@ -461,9 +460,7 @@ def _AugAssign(self, node): pass def _For(self, node): - names = self._update_evaluated( - node.target, node.iter, ".__iter__().next()" # noqa - ) + self._update_evaluated(node.target, node.iter, ".__iter__().next()") for child in node.body + node.orelse: ast.walk(child, self) diff --git a/rope/contrib/autoimport/__init__.py b/rope/contrib/autoimport/__init__.py index 0a3b59f1c..7f8381c8b 100644 --- a/rope/contrib/autoimport/__init__.py +++ b/rope/contrib/autoimport/__init__.py @@ -2,6 +2,7 @@ from .pickle import AutoImport as _PickleAutoImport from .sqlite import AutoImport as _SqliteAutoImport +assert _SqliteAutoImport # Workaround for an apparent pyflakes bug. AutoImport = _PickleAutoImport diff --git a/rope/refactor/__init__.py b/rope/refactor/__init__.py index a43d3b86c..0cc55e888 100644 --- a/rope/refactor/__init__.py +++ b/rope/refactor/__init__.py @@ -45,8 +45,11 @@ monitoring the progress of refactorings. """ -from rope.refactor.importutils import ImportOrganizer # noqa -from rope.refactor.topackage import ModuleToPackage # noqa +from rope.refactor.importutils import ImportOrganizer # essential. +from rope.refactor.topackage import ModuleToPackage # essential. + +assert ImportOrganizer +assert ModuleToPackage __all__ = [ diff --git a/rope/refactor/inline.py b/rope/refactor/inline.py index 1644bb2c0..36c7e7c4e 100644 --- a/rope/refactor/inline.py +++ b/rope/refactor/inline.py @@ -22,7 +22,6 @@ import rope.base.exceptions import rope.refactor.functionutils from rope.base import ( - ast, pynames, pyobjects, codeanalyze, diff --git a/rope/refactor/patchedast.py b/rope/refactor/patchedast.py index f7882e232..59444021a 100644 --- a/rope/refactor/patchedast.py +++ b/rope/refactor/patchedast.py @@ -927,7 +927,7 @@ def consume(self, token, skip_comment=True): break else: self._skip_comment() - except (ValueError, TypeError) as e: + except (ValueError, TypeError): raise MismatchedTokenError( "Token <{}> at {} cannot be matched".format(token, self._get_location()) ) diff --git a/rope/refactor/suites.py b/rope/refactor/suites.py index 015902e6f..6e7eb454e 100644 --- a/rope/refactor/suites.py +++ b/rope/refactor/suites.py @@ -1,7 +1,6 @@ from itertools import chain from rope.base import ast -from rope.base.utils import pycompat def find_visible(node, lines): diff --git a/ropetest/advanced_oi_test.py b/ropetest/advanced_oi_test.py index ee9f997f8..364f2d6f0 100644 --- a/ropetest/advanced_oi_test.py +++ b/ropetest/advanced_oi_test.py @@ -1,12 +1,9 @@ from textwrap import dedent - -from rope.base.builtins import Str - import unittest +from rope.base.builtins import Str import rope.base.libutils import rope.base.oi -from rope.base.utils import pycompat from ropetest import testutils @@ -1052,9 +1049,10 @@ def test_validation_problems_for_changing_builtin_types(self): l = {} v = l["key"] """)) - pymod1 = self.project.get_pymodule(mod1) # noqa - var = pymod1["v"].get_object() # noqa - + pymod1 = self.project.get_pymodule(mod1) + var = pymod1["v"].get_object() + self.assertTrue(pymod1 is not None) + self.assertTrue(var is not None) def test_always_returning_containing_class_for_selfs(self): code = dedent("""\ class A(object): @@ -1100,3 +1098,4 @@ def test_set_comprehension(self): self.mod.write(code) pymod = self.project.get_pymodule(self.mod) x_var = pymod["x"].pyobject.get() + self.assertTrue(x_var is not None) diff --git a/ropetest/builtinstest.py b/ropetest/builtinstest.py index 8f276a9a0..1b5b10045 100644 --- a/ropetest/builtinstest.py +++ b/ropetest/builtinstest.py @@ -485,8 +485,9 @@ class C1(object): pymod = self.project.get_pymodule(self.mod) c1_class = pymod["C1"].get_object() a_var = pymod["a"].get_object() - b_var = pymod["b"].get_object() # noqa + b_var = pymod["b"].get_object() self.assertEqual(c1_class, a_var.get_type()) + self.assertTrue(b_var is not None) def test_enumerate_builtin_function(self): self.mod.write(dedent("""\ diff --git a/ropetest/codeanalyzetest.py b/ropetest/codeanalyzetest.py index 435192fb0..9442578e1 100644 --- a/ropetest/codeanalyzetest.py +++ b/ropetest/codeanalyzetest.py @@ -335,7 +335,8 @@ def test_getting_primary_before_get_index(self): def test_getting_primary_and_strings_at_the_end_of_line(self): code = "f('\\'')\n" - result = self._find_primary(code, len(code) - 1) # noqa + result = self._find_primary(code, len(code) - 1) + self.assertTrue(result is not None) def test_getting_primary_and_not_crossing_newlines(self): code = "\na = (b + c)\n(4 + 1).x\n" @@ -753,7 +754,7 @@ def test_relative_modules_after_from_statements2(self): mod1 = testutils.create_module(self.project, "mod1") pkg1 = testutils.create_package(self.project, "pkg1") pkg2 = testutils.create_package(self.project, "pkg2", pkg1) - mod2 = testutils.create_module(self.project, "mod2", pkg2) # noqa + mod2 = testutils.create_module(self.project, "mod2", pkg2) mod1.write("import pkg1.pkg2.mod2") mod1_scope = self.project.get_pymodule(mod1).get_scope() @@ -761,6 +762,7 @@ def test_relative_modules_after_from_statements2(self): pkg2_pyobject = self.project.get_pymodule(pkg2) found_pyname = name_finder.get_pyname_at(mod1.read().index("pkg2") + 1) self.assertEqual(pkg2_pyobject, found_pyname.get_object()) + self.assertTrue(mod2 is not None) def test_get_pyname_at_on_language_keywords(self): code = dedent("""\ diff --git a/ropetest/contrib/autoimport/utilstest.py b/ropetest/contrib/autoimport/utilstest.py index 91e1622f4..0c818cd8c 100644 --- a/ropetest/contrib/autoimport/utilstest.py +++ b/ropetest/contrib/autoimport/utilstest.py @@ -1,9 +1,5 @@ """Tests for autoimport utility functions, written in pytest""" -from sys import platform - -import pytest - from rope.contrib.autoimport import utils from rope.contrib.autoimport.defs import Package, PackageType, Source @@ -59,5 +55,5 @@ def test_get_package_tuple_typing(typing_path): def test_get_package_tuple_compiled(compiled_lib): lib_name, lib_path = compiled_lib assert Package( - lib_name, Source.STANDARD, lib_path, PackageType.COMPILED + lib_name, Source.STANDARD, lib_path, PackageType.COMPILED ) == utils.get_package_tuple(lib_path) diff --git a/ropetest/contrib/codeassisttest.py b/ropetest/contrib/codeassisttest.py index 7d07bc2a0..1739ae580 100644 --- a/ropetest/contrib/codeassisttest.py +++ b/ropetest/contrib/codeassisttest.py @@ -718,7 +718,8 @@ def my_global_func(): pass my_""") result = self._assist(code) - proposals = sorted_proposals(result, typepref=["function"]) # noqa + proposals = sorted_proposals(result, typepref=["function"]) + self.assertTrue(proposals is not None) def test_get_pydoc_unicode(self): src = dedent('''\ @@ -824,7 +825,8 @@ def test_commenting_errors_before_offset(self): s = "hey" s.replace() """) - doc = get_doc(self.project, src, src.rindex("replace") + 1) # noqa + doc = get_doc(self.project, src, src.rindex("replace") + 1) + self.assertTrue(doc is not None) def test_proposing_variables_defined_till_the_end_of_scope(self): code = dedent("""\ @@ -928,7 +930,8 @@ def test_and_normal_complete_blocks_and_single_fixing(self): except: pass """) - result = self._assist(code, code.index("."), maxfixes=1) # noqa + result = self._assist(code, code.index("."), maxfixes=1) + self.assertTrue(result is not None) def test_nested_blocks(self): code = dedent("""\ @@ -951,7 +954,8 @@ def test_proposing_function_keywords_when_calling_for_non_functions(self): code = dedent("""\ f = 1 f(p""") - result = self._assist(code) # noqa + result = self._assist(code) + self.assertTrue(result is not None) def test_proposing_function_keywords_when_calling_extra_spaces(self): code = dedent("""\ @@ -1337,7 +1341,8 @@ def _underlined_func(): """) samplemod.write(code) package = testutils.create_package(self.project, "package") - nestedmod = testutils.create_module(self.project, "nestedmod", package) # noqa + nestedmod = testutils.create_module(self.project, "nestedmod", package) + self.assertTrue(nestedmod is not None) def tearDown(self): testutils.remove_project(self.project) diff --git a/ropetest/contrib/fixmodnamestest.py b/ropetest/contrib/fixmodnamestest.py index 389741c82..21abd1caf 100644 --- a/ropetest/contrib/fixmodnamestest.py +++ b/ropetest/contrib/fixmodnamestest.py @@ -42,11 +42,12 @@ def test_fixing_contents(self): def test_handling_nested_modules(self): pkg = create_package(self.project, "xkg") - mod = create_module(self.project, "xkg.xod") # noqa + mod = create_module(self.project, "xkg.xod") self.project.do(FixModuleNames(self.project).get_changes(_fixer)) self.assertFalse(pkg.exists()) self.assertTrue(self.project.get_resource("_kg/__init__.py").exists()) self.assertTrue(self.project.get_resource("_kg/_od.py").exists()) + self.assertTrue(mod is not None) def _fixer(name): diff --git a/ropetest/historytest.py b/ropetest/historytest.py index ba6220428..a531a362e 100644 --- a/ropetest/historytest.py +++ b/ropetest/historytest.py @@ -373,7 +373,7 @@ def test_change_set_saving(self): self.assertFalse(myfile.exists()) def test_writing_and_reading_history(self): - history_file = self.project.get_file("history.pickle") # noqa + history_file = self.project.get_file("history.pickle") self.project.set("save_history", True) history = rope.base.history.History(self.project) myfile = self.project.get_file("myfile.txt") @@ -383,9 +383,10 @@ def test_writing_and_reading_history(self): history = rope.base.history.History(self.project) history.undo() self.assertFalse(myfile.exists()) + self.assertTrue(history_file is not None) def test_writing_and_reading_history2(self): - history_file = self.project.get_file("history.pickle") # noqa + history_file = self.project.get_file("history.pickle") self.project.set("save_history", True) history = rope.base.history.History(self.project) myfile = self.project.get_file("myfile.txt") @@ -396,3 +397,4 @@ def test_writing_and_reading_history2(self): history = rope.base.history.History(self.project) history.redo() self.assertTrue(myfile.exists()) + self.assertTrue(history_file is not None) diff --git a/ropetest/objectinfertest.py b/ropetest/objectinfertest.py index 578647243..1869c180e 100644 --- a/ropetest/objectinfertest.py +++ b/ropetest/objectinfertest.py @@ -285,7 +285,8 @@ def test_empty_tuples(self): """) mod = libutils.get_string_module(self.project, code) - a = mod["a"].get_object() # noqa + a = mod["a"].get_object() + self.assertTrue(a is not None) def test_handling_generator_functions(self): code = dedent("""\ diff --git a/ropetest/projecttest.py b/ropetest/projecttest.py index 8bf8b8e25..df67c3f23 100644 --- a/ropetest/projecttest.py +++ b/ropetest/projecttest.py @@ -1,8 +1,7 @@ import os.path import shutil from textwrap import dedent - -import pytest +import unittest from rope.base.exceptions import RopeError, ResourceNotFoundError from rope.base.fscommands import FileSystemCommands @@ -12,9 +11,6 @@ from ropetest import testutils -import unittest - - class ProjectTest(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) @@ -705,7 +701,7 @@ def test_revalidating_files_and_no_changes2(self): def test_revalidating_folders(self): root = self.project.root my_folder = root.create_folder("myfolder") - my_file = my_folder.create_file("myfile.txt") # noqa + my_file = my_folder.create_file("myfile.txt") sample_observer = _SampleObserver() self.project.add_observer( FilteredResourceObserver(sample_observer, [my_folder]) @@ -714,6 +710,7 @@ def test_revalidating_folders(self): self.project.validate(root) self.assertEqual(my_folder, sample_observer.last_removed) self.assertEqual(1, sample_observer.change_count) + self.assertTrue(my_file is not None) def test_removing_and_adding_resources_to_filtered_observer(self): my_file = self.project.root.create_file("my_file.txt") @@ -812,7 +809,7 @@ def test_validating_twice_when_created(self): self.assertEqual(1, sample_observer.change_count) def test_changes_and_adding_resources(self): - root = self.project.root # noqa + # root = self.project.root file1 = self.project.get_file("file1.txt") file2 = self.project.get_file("file2.txt") file1.create() @@ -826,7 +823,7 @@ def test_changes_and_adding_resources(self): self.assertEqual((file1, file2), sample_observer.last_moved) def test_validating_get_files_list(self): - root = self.project.root # noqa + # root = self.project.root self.assertEqual(0, len(self.project.get_files())) file = open(os.path.join(self.project.address, "myfile.txt"), "w") file.close() @@ -1040,8 +1037,9 @@ def test_ignored_resources_and_get_files2(self): self.project = testutils.sample_project( ignored_resources=["myfile.txt"], ropefolder=None ) - myfile = self.project.root.create_file("myfile.txt") # noqa + myfile = self.project.root.create_file("myfile.txt") self.assertEqual(0, len(self.project.get_files())) + self.assertTrue(myfile is not None) def test_setting_ignored_resources_patterns(self): self.project = testutils.sample_project(ignored_resources=["m?file.*"]) @@ -1162,7 +1160,8 @@ def test_ignoring_syntax_errors(self): ) mod = testutils.create_module(self.project, "mod") mod.write("xyz print") - pymod = self.project.get_pymodule(mod) # noqa + pymod = self.project.get_pymodule(mod) + self.assertTrue(pymod is not None) def test_compressed_history(self): self.project = testutils.sample_project(compress_history=True) diff --git a/ropetest/pycoretest.py b/ropetest/pycoretest.py index 417c762d3..15ce1159e 100644 --- a/ropetest/pycoretest.py +++ b/ropetest/pycoretest.py @@ -31,18 +31,19 @@ def test_simple_module(self): def test_nested_modules(self): pkg = testutils.create_package(self.project, "pkg") - mod = testutils.create_module(self.project, "mod", pkg) # noqa + mod = testutils.create_module(self.project, "mod", pkg) package = self.project.get_module("pkg") self.assertEqual(get_base_type("Module"), package.get_type()) self.assertEqual(1, len(package.get_attributes())) module = package["mod"].get_object() self.assertEqual(get_base_type("Module"), module.get_type()) - + self.assertTrue(mod is not None) def test_package(self): pkg = testutils.create_package(self.project, "pkg") - mod = testutils.create_module(self.project, "mod", pkg) # noqa + mod = testutils.create_module(self.project, "mod", pkg) result = self.project.get_module("pkg") self.assertEqual(get_base_type("Module"), result.type) + self.assertTrue(mod is not None) def test_simple_class(self): mod = testutils.create_module(self.project, "mod") @@ -101,7 +102,8 @@ class SampleClass(object): """)) mod_element = self.project.get_module("mod") sample_class = mod_element["SampleClass"].get_object() - var = sample_class["var"] # noqa + var = sample_class["var"] + self.assertTrue(var is not None) def test_class_attributes_set_in_init(self): mod = testutils.create_module(self.project, "mod") @@ -112,7 +114,8 @@ def __init__(self): """)) mod_element = self.project.get_module("mod") sample_class = mod_element["C"].get_object() - var = sample_class["var"] # noqa + var = sample_class["var"] + self.assertTrue(var is not None) def test_class_attributes_set_in_init_overwriting_a_defined(self): mod = testutils.create_module(self.project, "mod") @@ -174,7 +177,8 @@ class Sample(object): def test_get_string_module_with_extra_spaces(self): code = "a = 10\n " - mod = libutils.get_string_module(self.project, code) # noqa + mod = libutils.get_string_module(self.project, code) + self.assertTrue(mod is not None) def test_parameter_info_for_functions(self): code = dedent("""\ @@ -264,9 +268,10 @@ def test_module_creation(self): self.assertEqual(self.project.get_resource("module.py"), new_module) def test_packaged_module_creation(self): - package = self.project.root.create_folder("package") # noqa + package = self.project.root.create_folder("package") new_module = testutils.create_module(self.project, "package.module") self.assertEqual(self.project.get_resource("package/module.py"), new_module) + self.assertTrue(package is not None) def test_packaged_module_creation_with_nested_src(self): src = self.project.root.create_folder("src") diff --git a/ropetest/pyscopestest.py b/ropetest/pyscopestest.py index 99321d2fc..224482dc5 100644 --- a/ropetest/pyscopestest.py +++ b/ropetest/pyscopestest.py @@ -48,11 +48,12 @@ class SampleClass(object): scope = libutils.get_string_scope(self.project, code) self.assertEqual(1, len(scope.get_scopes())) - sample_func_scope = scope.get_scopes()[0] # noqa + sample_func_scope = scope.get_scopes()[0] self.assertEqual( get_base_type("Type"), scope.get_scopes()[0]["SampleClass"].get_object().get_type(), ) + self.assertTrue(sample_func_scope is not None) def test_list_comprehension_scope_inside_assignment(self): code = "a_var = [b_var + d_var for b_var, c_var in e_var]\n" @@ -468,12 +469,13 @@ def b(self): """) scope = libutils.get_string_scope(self.project, code) - a_scope = scope["A"].get_object().get_scope() # noqa + a_scope = scope["A"].get_object().get_scope() b_scope = scope["B"].get_object().get_scope() self.assertTrue("a" in b_scope.get_names()) self.assertTrue("b" in b_scope.get_names()) self.assertTrue("a" not in b_scope.get_defined_names()) self.assertTrue("b" in b_scope.get_defined_names()) + self.assertTrue(a_scope is not None) def test_getting_defined_names_for_modules(self): code = dedent("""\ diff --git a/ropetest/refactor/__init__.py b/ropetest/refactor/__init__.py index 27f4ecd0f..49472f525 100644 --- a/ropetest/refactor/__init__.py +++ b/ropetest/refactor/__init__.py @@ -4,23 +4,12 @@ import rope.base.taskhandle import rope.refactor.introduce_parameter -import ropetest.refactor.extracttest -import ropetest.refactor.importutilstest -import ropetest.refactor.inlinetest -import ropetest.refactor.movetest -import ropetest.refactor.multiprojecttest -import ropetest.refactor.patchedasttest -import ropetest.refactor.renametest -import ropetest.refactor.restructuretest -import ropetest.refactor.suitestest -import ropetest.refactor.usefunctiontest from rope.base.exceptions import RefactoringError, InterruptedTaskError from rope.refactor.encapsulate_field import EncapsulateField from rope.refactor.introduce_factory import IntroduceFactory from rope.refactor.localtofield import LocalToField from rope.refactor.method_object import MethodObject from ropetest import testutils -from ropetest.refactor import change_signature_test, similarfindertest class MethodObjectTest(unittest.TestCase): @@ -1093,8 +1082,9 @@ def test_calling_the_observer_after_creating_job_sets(self): handle = rope.base.taskhandle.TaskHandle() observer = _MockTaskObserver() handle.add_observer(observer) - jobs = handle.create_jobset() # noqa + jobs = handle.create_jobset() self.assertEqual(1, observer.called) + self.assertTrue(jobs is not None) def test_calling_the_observer_when_starting_and_finishing_jobs(self): handle = rope.base.taskhandle.TaskHandle() diff --git a/ropetest/refactor/importutilstest.py b/ropetest/refactor/importutilstest.py index ec8edbebf..7839f23d5 100644 --- a/ropetest/refactor/importutilstest.py +++ b/ropetest/refactor/importutilstest.py @@ -21,8 +21,10 @@ def setUp(self): p1 = testutils.create_package(self.project, "p1") p2 = testutils.create_package(self.project, "p2", p1) p3 = testutils.create_package(self.project, "p3", p2) - m1 = testutils.create_module(self.project, "m1", p3) # noqa - l = testutils.create_module(self.project, "l", p3) # noqa + m1 = testutils.create_module(self.project, "m1", p3) + mod_l = testutils.create_module(self.project, "l", p3) + self.assertTrue(m1 is not None) + self.assertTrue(mod_l is not None) def tearDown(self): testutils.remove_project(self.project) diff --git a/ropetest/refactor/movetest.py b/ropetest/refactor/movetest.py index 90a1e1f3d..6fa1100a7 100644 --- a/ropetest/refactor/movetest.py +++ b/ropetest/refactor/movetest.py @@ -314,6 +314,7 @@ class TestClass: mover = move.create_move( self.project, self.mod1, code.index("CONSTANT") + 1 ) + self.assertTrue(mover is not None) def test_raising_exception_for_mov_glob_elemnts_to_the_same_module(self): self.mod1.write("def a_func():\n pass\n") diff --git a/ropetest/refactor/patchedasttest.py b/ropetest/refactor/patchedasttest.py index 25298c453..622e9bd3c 100644 --- a/ropetest/refactor/patchedasttest.py +++ b/ropetest/refactor/patchedasttest.py @@ -1558,7 +1558,6 @@ def test_match_node_with_match_class_match_as_capture_pattern_with_explicit_name ")", ]) - @testutils.only_for_versions_higher("3.10") def test_match_node_with_match_mapping_match_as(self): source = dedent("""\ @@ -1587,8 +1586,6 @@ def test_match_node_with_match_mapping_match_as(self): "", "}", ]) - - class _ResultChecker: def __init__(self, test_case, ast): self.test_case = test_case diff --git a/ropetest/testutils.py b/ropetest/testutils.py index 45bf13cc7..5ec4c7acd 100644 --- a/ropetest/testutils.py +++ b/ropetest/testutils.py @@ -2,13 +2,13 @@ import shutil import sys import logging - -logging.basicConfig(format="%(levelname)s:%(funcName)s:%(message)s", level=logging.INFO) import unittest import rope.base.project from rope.contrib import generate +logging.basicConfig(format="%(levelname)s:%(funcName)s:%(message)s", level=logging.INFO) + def sample_project(root=None, foldername=None, **kwds): if root is None: @@ -51,7 +51,7 @@ def remove_recursively(path): # windows sometimes raises exceptions instead of removing files if os.name == "nt" or sys.platform == "cygwin": - for i in range(12): + for _i in range(12): try: _remove_recursively(path) except OSError as e: diff --git a/ropetest/type_hinting_test.py b/ropetest/type_hinting_test.py index 861c278b7..624da6a4d 100644 --- a/ropetest/type_hinting_test.py +++ b/ropetest/type_hinting_test.py @@ -278,6 +278,7 @@ def test_hint_or(self): result = self._assist(code) # Be sure, there isn't errors currently # self.assert_completion_in_result('is_alive', 'attribute', result) + self.assertTrue(result is not None) def test_hint_nonexistent(self): code = ( diff --git a/setup.py b/setup.py index fc1f76c84..606849326 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,3 @@ from setuptools import setup -setup() \ No newline at end of file +setup()