summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gilman <davidgilman1@gmail.com>2021-01-01 15:31:13 -0500
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-16 07:53:15 +0100
commita8ac365628ddd2a87db9418d6a0b1e4027ee6410 (patch)
treeb7f9c0cdc75f5f418b5761ab0f8adca996bb929a
parente48946f0b4bd385fcd93b6ef920d092f0d8d7424 (diff)
downloadpylint-git-a8ac365628ddd2a87db9418d6a0b1e4027ee6410.tar.gz
Remove six dependency from test suite
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--tests/checkers/unittest_typecheck.py11
-rw-r--r--tests/functional/a/abstract_class_instantiated_in_class.py5
-rw-r--r--tests/functional/i/invalid_exceptions_caught.rc2
-rw-r--r--tests/functional/m/member_checks.py5
-rw-r--r--tests/functional/m/member_checks.txt38
-rw-r--r--tests/functional/n/non_iterator_returned.py5
-rw-r--r--tests/functional/n/non_iterator_returned.txt8
-rw-r--r--tests/functional/s/slots_checks.py6
-rw-r--r--tests/functional/s/slots_checks.txt6
-rw-r--r--tests/functional/u/unpacking_non_sequence.py3
-rw-r--r--tests/functional/u/unpacking_non_sequence.txt18
-rw-r--r--tests/functional/u/unsubscriptable_value.rc2
-rw-r--r--tests/functional/u/unsupported_assignment_operation.rc2
-rw-r--r--tests/functional/u/unsupported_delete_operation.rc2
-rw-r--r--tests/functional/u/unused_variable.py4
-rw-r--r--tests/functional/u/unused_variable.txt2
17 files changed, 57 insertions, 64 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index cdf7db72f..037ed3984 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -443,3 +443,5 @@ contributors:
* Matthew Suozzo: contributor
* Marc Mueller (cdce8p): contributor
+
+* David Gilman: contributor
diff --git a/tests/checkers/unittest_typecheck.py b/tests/checkers/unittest_typecheck.py
index b33a491e0..802a00e7c 100644
--- a/tests/checkers/unittest_typecheck.py
+++ b/tests/checkers/unittest_typecheck.py
@@ -210,21 +210,16 @@ class TestTypeChecker(CheckerTestCase):
def test_invalid_metaclass(self):
module = astroid.parse(
"""
- import six
-
class InvalidAsMetaclass(object):
pass
- @six.add_metaclass(int)
- class FirstInvalid(object):
+ class FirstInvalid(object, metaclass=int):
pass
- @six.add_metaclass(InvalidAsMetaclass)
- class SecondInvalid(object):
+ class SecondInvalid(object, metaclass=InvalidAsMetaclass):
pass
- @six.add_metaclass(2)
- class ThirdInvalid(object):
+ class ThirdInvalid(object, metaclass=2):
pass
"""
)
diff --git a/tests/functional/a/abstract_class_instantiated_in_class.py b/tests/functional/a/abstract_class_instantiated_in_class.py
index a91fde579..daaa3b689 100644
--- a/tests/functional/a/abstract_class_instantiated_in_class.py
+++ b/tests/functional/a/abstract_class_instantiated_in_class.py
@@ -4,11 +4,8 @@
import abc
-import six
-
-@six.add_metaclass(abc.ABCMeta)
-class Ala(object):
+class Ala(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def bala(self):
diff --git a/tests/functional/i/invalid_exceptions_caught.rc b/tests/functional/i/invalid_exceptions_caught.rc
new file mode 100644
index 000000000..6a8ee96ca
--- /dev/null
+++ b/tests/functional/i/invalid_exceptions_caught.rc
@@ -0,0 +1,2 @@
+[testoptions]
+requires = six
diff --git a/tests/functional/m/member_checks.py b/tests/functional/m/member_checks.py
index 384653c89..30f16c58c 100644
--- a/tests/functional/m/member_checks.py
+++ b/tests/functional/m/member_checks.py
@@ -1,7 +1,6 @@
# pylint: disable=print-statement,missing-docstring,no-self-use,too-few-public-methods,bare-except,broad-except, useless-object-inheritance
# pylint: disable=using-constant-test,expression-not-assigned, assigning-non-slot, unused-variable,pointless-statement, wrong-import-order, wrong-import-position,import-outside-toplevel
from __future__ import print_function
-import six
class Provider(object):
"""provide some attributes and method"""
cattr = 4
@@ -183,8 +182,8 @@ class MetaWithDynamicGetattr(type):
def __getattr__(cls, attr):
return attr
-@six.add_metaclass(MetaWithDynamicGetattr)
-class SomeClass(object):
+
+class SomeClass(object, metaclass=MetaWithDynamicGetattr):
pass
diff --git a/tests/functional/m/member_checks.txt b/tests/functional/m/member_checks.txt
index 746ab6d39..0b7ee9478 100644
--- a/tests/functional/m/member_checks.txt
+++ b/tests/functional/m/member_checks.txt
@@ -1,19 +1,19 @@
-no-member:24:27:Client.__init__:Class 'Provider' has no 'cattribute' member:INFERENCE
-no-member:34:8:Client.use_method:Instance of 'Provider' has no 'hophophop' member:INFERENCE
-no-member:39:14:Client.use_attr:Instance of 'Provider' has no 'attribute' member:INFERENCE
-no-member:51:8:Client.test_bt_types:Instance of 'list' has no 'apppend' member; maybe 'append'?:INFERENCE
-no-member:53:8:Client.test_bt_types:Instance of 'dict' has no 'set' member; maybe 'get'?:INFERENCE
-no-member:55:8:Client.test_bt_types:Instance of 'tuple' has no 'append' member:INFERENCE
-no-member:57:14:Client.test_bt_types:Instance of 'str' has no 'loower' member; maybe 'lower'?:INFERENCE
-no-member:59:14:Client.test_bt_types:Instance of 'int' has no 'whatever' member:INFERENCE
-no-member:65:8:Client.test_no_false_positives:Super of 'Client' has no 'misssing' member:INFERENCE
-no-member:97:4::Instance of 'Client' has no 'indeed' member:INFERENCE
-no-member:104:4::Class 'Client' has no 'missing' member:INFERENCE
-no-member:110:8::Class 'Client' has no 'missing' member:INFERENCE
-no-member:124:8::Class 'Client' has no 'missing' member:INFERENCE
-no-member:134:0::Class 'Client' has no 'ala' member:INFERENCE
-no-member:135:0::Class 'dict' has no 'bala' member:INFERENCE
-no-member:136:0::Class 'str' has no 'portocala' member:INFERENCE
-no-member:171:19:NoDunderNameInInstance.__init__:Instance of 'NoDunderNameInInstance' has no '__name__' member:INFERENCE
-no-member:177:14:InvalidAccessBySlots.__init__:Instance of 'InvalidAccessBySlots' has no 'teta' member:INFERENCE
-no-member:209:13::Class 'Cls' has no 'BAZ' member; maybe 'BAR'?:INFERENCE
+no-member:23:27:Client.__init__:Class 'Provider' has no 'cattribute' member:INFERENCE
+no-member:33:8:Client.use_method:Instance of 'Provider' has no 'hophophop' member:INFERENCE
+no-member:38:14:Client.use_attr:Instance of 'Provider' has no 'attribute' member:INFERENCE
+no-member:50:8:Client.test_bt_types:Instance of 'list' has no 'apppend' member; maybe 'append'?:INFERENCE
+no-member:52:8:Client.test_bt_types:Instance of 'dict' has no 'set' member; maybe 'get'?:INFERENCE
+no-member:54:8:Client.test_bt_types:Instance of 'tuple' has no 'append' member:INFERENCE
+no-member:56:14:Client.test_bt_types:Instance of 'str' has no 'loower' member; maybe 'lower'?:INFERENCE
+no-member:58:14:Client.test_bt_types:Instance of 'int' has no 'whatever' member:INFERENCE
+no-member:64:8:Client.test_no_false_positives:Super of 'Client' has no 'misssing' member:INFERENCE
+no-member:96:4::Instance of 'Client' has no 'indeed' member:INFERENCE
+no-member:103:4::Class 'Client' has no 'missing' member:INFERENCE
+no-member:109:8::Class 'Client' has no 'missing' member:INFERENCE
+no-member:123:8::Class 'Client' has no 'missing' member:INFERENCE
+no-member:133:0::Class 'Client' has no 'ala' member:INFERENCE
+no-member:134:0::Class 'dict' has no 'bala' member:INFERENCE
+no-member:135:0::Class 'str' has no 'portocala' member:INFERENCE
+no-member:170:19:NoDunderNameInInstance.__init__:Instance of 'NoDunderNameInInstance' has no '__name__' member:INFERENCE
+no-member:176:14:InvalidAccessBySlots.__init__:Instance of 'InvalidAccessBySlots' has no 'teta' member:INFERENCE
+no-member:208:13::Class 'Cls' has no 'BAZ' member; maybe 'BAR'?:INFERENCE
diff --git a/tests/functional/n/non_iterator_returned.py b/tests/functional/n/non_iterator_returned.py
index 32486f722..89bcdb7d9 100644
--- a/tests/functional/n/non_iterator_returned.py
+++ b/tests/functional/n/non_iterator_returned.py
@@ -2,8 +2,6 @@
# pylint: disable=too-few-public-methods, missing-docstring, no-self-use, useless-object-inheritance
-import six
-
class FirstGoodIterator(object):
""" yields in iterator. """
@@ -46,8 +44,7 @@ class IteratorMetaclass(type):
return 2
-@six.add_metaclass(IteratorMetaclass)
-class IteratorClass(object):
+class IteratorClass(object, metaclass=IteratorMetaclass):
"""Iterable through the metaclass."""
diff --git a/tests/functional/n/non_iterator_returned.txt b/tests/functional/n/non_iterator_returned.txt
index bdb33859e..ab9d69e7e 100644
--- a/tests/functional/n/non_iterator_returned.txt
+++ b/tests/functional/n/non_iterator_returned.txt
@@ -1,4 +1,4 @@
-non-iterator-returned:76:4:FirstBadIterator.__iter__:__iter__ returns non-iterator
-non-iterator-returned:82:4:SecondBadIterator.__iter__:__iter__ returns non-iterator
-non-iterator-returned:88:4:ThirdBadIterator.__iter__:__iter__ returns non-iterator
-non-iterator-returned:94:4:FourthBadIterator.__iter__:__iter__ returns non-iterator
+non-iterator-returned:73:4:FirstBadIterator.__iter__:__iter__ returns non-iterator
+non-iterator-returned:79:4:SecondBadIterator.__iter__:__iter__ returns non-iterator
+non-iterator-returned:85:4:ThirdBadIterator.__iter__:__iter__ returns non-iterator
+non-iterator-returned:91:4:FourthBadIterator.__iter__:__iter__ returns non-iterator
diff --git a/tests/functional/s/slots_checks.py b/tests/functional/s/slots_checks.py
index 64a439f33..191fd1c95 100644
--- a/tests/functional/s/slots_checks.py
+++ b/tests/functional/s/slots_checks.py
@@ -64,9 +64,6 @@ class PotentiallySecondGood(object):
__slots__ = ('a', deque.__name__)
-import six
-
-
class Metaclass(type):
def __iter__(cls):
@@ -74,8 +71,7 @@ class Metaclass(type):
yield str(value)
-@six.add_metaclass(Metaclass)
-class IterableClass(object):
+class IterableClass(object, metaclass=Metaclass):
pass
class PotentiallyThirdGood(object):
diff --git a/tests/functional/s/slots_checks.txt b/tests/functional/s/slots_checks.txt
index 9994772fb..ffe82f8a1 100644
--- a/tests/functional/s/slots_checks.txt
+++ b/tests/functional/s/slots_checks.txt
@@ -6,6 +6,6 @@ invalid-slots-object:49:27:FifthBad:"Invalid object ""''"" in __slots__, must co
single-string-used-for-slots:51:0:SixthBad:Class __slots__ should be a non-string iterable
single-string-used-for-slots:54:0:SeventhBad:Class __slots__ should be a non-string iterable
single-string-used-for-slots:57:0:EighthBad:Class __slots__ should be a non-string iterable
-class-variable-slots-conflict:89:17:ValueInSlotConflict:Value 'first' in slots conflicts with class variable
-class-variable-slots-conflict:89:45:ValueInSlotConflict:Value 'fourth' in slots conflicts with class variable
-class-variable-slots-conflict:89:36:ValueInSlotConflict:Value 'third' in slots conflicts with class variable
+class-variable-slots-conflict:85:17:ValueInSlotConflict:Value 'first' in slots conflicts with class variable
+class-variable-slots-conflict:85:45:ValueInSlotConflict:Value 'fourth' in slots conflicts with class variable
+class-variable-slots-conflict:85:36:ValueInSlotConflict:Value 'third' in slots conflicts with class variable
diff --git a/tests/functional/u/unpacking_non_sequence.py b/tests/functional/u/unpacking_non_sequence.py
index 38eca384c..c681641ca 100644
--- a/tests/functional/u/unpacking_non_sequence.py
+++ b/tests/functional/u/unpacking_non_sequence.py
@@ -3,7 +3,6 @@
# pylint: disable=too-few-public-methods, invalid-name, attribute-defined-outside-init, unused-variable, no-absolute-import
# pylint: disable=using-constant-test, no-init, missing-docstring, wrong-import-order,wrong-import-position,no-else-return, useless-object-inheritance
from os import rename as nonseq_func
-from six import with_metaclass
from functional.u.unpacking import nonseq
__revision__ = 0
@@ -43,7 +42,7 @@ class MetaIter(type):
def __iter__(cls):
return iter((1, 2))
-class IterClass(with_metaclass(MetaIter)):
+class IterClass(metaclass=MetaIter):
"class that is iterable (and unpackable)"
class AbstrClass(object):
diff --git a/tests/functional/u/unpacking_non_sequence.txt b/tests/functional/u/unpacking_non_sequence.txt
index 42f410091..0ac2bc29a 100644
--- a/tests/functional/u/unpacking_non_sequence.txt
+++ b/tests/functional/u/unpacking_non_sequence.txt
@@ -1,10 +1,10 @@
-unpacking-non-sequence:78:0::Attempting to unpack a non-sequence defined at line 75
-unpacking-non-sequence:79:0::Attempting to unpack a non-sequence
-unpacking-non-sequence:80:0::Attempting to unpack a non-sequence None
-unpacking-non-sequence:81:0::Attempting to unpack a non-sequence 1
-unpacking-non-sequence:82:0::Attempting to unpack a non-sequence defined at line 9 of functional.u.unpacking
-unpacking-non-sequence:83:0::Attempting to unpack a non-sequence defined at line 11 of functional.u.unpacking
-unpacking-non-sequence:84:0::Attempting to unpack a non-sequence
-unpacking-non-sequence:99:8:ClassUnpacking.test:Attempting to unpack a non-sequence defined at line 75
+unpacking-non-sequence:77:0::Attempting to unpack a non-sequence defined at line 74
+unpacking-non-sequence:78:0::Attempting to unpack a non-sequence
+unpacking-non-sequence:79:0::Attempting to unpack a non-sequence None
+unpacking-non-sequence:80:0::Attempting to unpack a non-sequence 1
+unpacking-non-sequence:81:0::Attempting to unpack a non-sequence defined at line 9 of functional.u.unpacking
+unpacking-non-sequence:82:0::Attempting to unpack a non-sequence defined at line 11 of functional.u.unpacking
+unpacking-non-sequence:83:0::Attempting to unpack a non-sequence
+unpacking-non-sequence:98:8:ClassUnpacking.test:Attempting to unpack a non-sequence defined at line 74
+unpacking-non-sequence:99:8:ClassUnpacking.test:Attempting to unpack a non-sequence
unpacking-non-sequence:100:8:ClassUnpacking.test:Attempting to unpack a non-sequence
-unpacking-non-sequence:101:8:ClassUnpacking.test:Attempting to unpack a non-sequence
diff --git a/tests/functional/u/unsubscriptable_value.rc b/tests/functional/u/unsubscriptable_value.rc
new file mode 100644
index 000000000..6a8ee96ca
--- /dev/null
+++ b/tests/functional/u/unsubscriptable_value.rc
@@ -0,0 +1,2 @@
+[testoptions]
+requires = six
diff --git a/tests/functional/u/unsupported_assignment_operation.rc b/tests/functional/u/unsupported_assignment_operation.rc
new file mode 100644
index 000000000..6a8ee96ca
--- /dev/null
+++ b/tests/functional/u/unsupported_assignment_operation.rc
@@ -0,0 +1,2 @@
+[testoptions]
+requires = six
diff --git a/tests/functional/u/unsupported_delete_operation.rc b/tests/functional/u/unsupported_delete_operation.rc
new file mode 100644
index 000000000..6a8ee96ca
--- /dev/null
+++ b/tests/functional/u/unsupported_delete_operation.rc
@@ -0,0 +1,2 @@
+[testoptions]
+requires = six
diff --git a/tests/functional/u/unused_variable.py b/tests/functional/u/unused_variable.py
index 2d2c540b9..e57e2abb1 100644
--- a/tests/functional/u/unused_variable.py
+++ b/tests/functional/u/unused_variable.py
@@ -56,8 +56,8 @@ def unused_import_from():
def unused_import_in_function(value):
- from six import PY2, text_type # [unused-import]
- return value.encode("utf-8") if PY2 else value
+ from string import digits, hexdigits # [unused-import]
+ return value if value in digits else "Nope"
def hello(arg):
diff --git a/tests/functional/u/unused_variable.txt b/tests/functional/u/unused_variable.txt
index 47a0dbb51..c11bc0dcc 100644
--- a/tests/functional/u/unused_variable.txt
+++ b/tests/functional/u/unused_variable.txt
@@ -10,5 +10,5 @@ unused-variable:41:4:locals_example_defined_after:Unused variable 'value'
unused-variable:46:4:locals_does_not_account_for_subscopes:Unused variable 'value'
unused-import:54:4:unused_import_from:Unused wraps imported from functools as abc
unused-import:55:4:unused_import_from:Unused namedtuple imported from collections
-unused-import:59:4:unused_import_in_function:Unused text_type imported from six
+unused-import:59:4:unused_import_in_function:Unused hexdigits imported from string
unused-variable:64:4:hello:Unused variable 'my_var'