Skip to content

Commit

Permalink
Add regression test for pylint-dev#7506
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Mar 11, 2023
1 parent 74e6efc commit 3548891
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7506.false_positive
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix ``unused-import`` false positive for usage of ``six.with_metaclass``.

Closes #7506
1 change: 1 addition & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ pytest-cov~=4.0
pytest-profiling~=1.7
pytest-xdist~=3.2
# Type packages for mypy
six
types-pkg_resources==0.1.3
tox>=3
7 changes: 5 additions & 2 deletions tests/functional/u/unused/unused_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# +1:[unused-import,unused-import]
from collections import deque, OrderedDict, Counter
import re, html.parser # [unused-import]
import six

DATA = Counter()
# pylint: disable=self-assigning-variable
Expand Down Expand Up @@ -98,8 +99,10 @@ def blop(self):
import zoneinfo


class WithMetaclass(metaclass=ABCMeta):
pass
class WithMetaclass(six.with_metaclass(ABCMeta)):
"""Regression test for https://github.com/PyCQA/pylint/issues/7506.
Requires six."""


# Regression test for https://github.com/PyCQA/pylint/issues/3765
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/u/unused/unused_import.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ unused-import:8:0:8:21::Unused flags imported from sys:UNDEFINED
unused-import:11:0:11:51::Unused OrderedDict imported from collections:UNDEFINED
unused-import:11:0:11:51::Unused deque imported from collections:UNDEFINED
unused-import:12:0:12:22::Unused import re:UNDEFINED
unused-import:16:0:16:40::Unused SomeOtherName imported from fake:UNDEFINED
unused-import:53:0:53:9::Unused import os:UNDEFINED
unused-import:88:4:88:19::Unused import unittest:UNDEFINED
unused-import:90:4:90:15::Unused import uuid:UNDEFINED
unused-import:92:4:92:19::Unused import warnings:UNDEFINED
unused-import:94:4:94:21::Unused import compileall:UNDEFINED
unused-import:17:0:17:40::Unused SomeOtherName imported from fake:UNDEFINED
unused-import:54:0:54:9::Unused import os:UNDEFINED
unused-import:89:4:89:19::Unused import unittest:UNDEFINED
unused-import:91:4:91:15::Unused import uuid:UNDEFINED
unused-import:93:4:93:19::Unused import warnings:UNDEFINED
unused-import:95:4:95:21::Unused import compileall:UNDEFINED

0 comments on commit 3548891

Please sign in to comment.