Skip to content

Commit 6ae32db

Browse files
authored
Don't use astroid in import tests (#10896)
1 parent 80c2e8e commit 6ae32db

6 files changed

Lines changed: 12 additions & 13 deletions

File tree

tests/functional/d/disable_wrong_import_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
import logging
88
import os.path
99
import sys
10-
from astroid import are_exclusive
10+
from pytest import mark
1111
from first_party.bar import foo # [ungrouped-imports]

tests/functional/ext/private_import/private_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from private_import import _private # pylint: disable=import-self
3232
from private_import.other_file import _private
3333
from . import _private
34-
from astroid import _private # [import-private-name]
34+
from pytest import _private # [import-private-name]
3535
from sys import _private # [import-private-name]
3636

3737
# Ignore typecheck

tests/functional/ext/private_import/private_import.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import-private-name:12:0:12:28::Imported private object (_d):HIGH
77
import-private-name:14:0:14:13::Imported private module (_house):HIGH
88
import-private-name:15:0:15:29::Imported private modules (_house, _chair, _stair):HIGH
99
import-private-name:16:0:16:28::Imported private modules (_chair, _stair):HIGH
10-
import-private-name:34:0:34:28::Imported private object (_private):HIGH
10+
import-private-name:34:0:34:27::Imported private object (_private):HIGH
1111
import-private-name:35:0:35:24::Imported private object (_private):HIGH
1212
import-private-name:86:0:86:57::Imported private module (_TypeContainerExtra2):HIGH
1313
import-private-name:91:0:91:22::Imported private module (_private_module):HIGH
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Checks import order rule with imports that isort could generate"""
22
# pylint: disable=unused-import
3-
import astroid
43
import isort
5-
from astroid import are_exclusive, decorators
6-
from astroid.modutils import get_module_part, is_standard_module
4+
import pytest
5+
from pytest import mark

tests/functional/w/wrong_import_order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
import six
1212
import os.path # [wrong-import-order]
13-
from astroid import are_exclusive
13+
from pytest import mark
1414
import sys # [wrong-import-order]
1515
import datetime # [wrong-import-order]
1616
import unused_import
1717
from .package import Class
1818
import totally_missing # [wrong-import-order]
1919
from . import package
20-
import astroid # [wrong-import-order]
20+
import pytest # [wrong-import-order]
2121
from . import package2
2222
import pylint.checkers # [wrong-import-order]
2323
from pylint import config # [wrong-import-order]
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
wrong-import-order:12:0:12:14::"standard import ""os.path"" should be placed before third party import ""six""":UNDEFINED
2-
wrong-import-order:14:0:14:10::"standard import ""sys"" should be placed before third party imports ""six"", ""astroid.are_exclusive""":UNDEFINED
3-
wrong-import-order:15:0:15:15::"standard import ""datetime"" should be placed before third party imports ""six"", ""astroid.are_exclusive""":UNDEFINED
2+
wrong-import-order:14:0:14:10::"standard import ""sys"" should be placed before third party imports ""six"", ""pytest.mark""":UNDEFINED
3+
wrong-import-order:15:0:15:15::"standard import ""datetime"" should be placed before third party imports ""six"", ""pytest.mark""":UNDEFINED
44
wrong-import-order:18:0:18:22::"third party import ""totally_missing"" should be placed before local import ""package.Class""":UNDEFINED
5-
wrong-import-order:20:0:20:14::"third party import ""astroid"" should be placed before local imports ""package.Class"", "".package""":UNDEFINED
5+
wrong-import-order:20:0:20:13::"third party import ""pytest"" should be placed before local imports ""package.Class"", "".package""":UNDEFINED
66
wrong-import-order:22:0:22:22::"first party import ""pylint.checkers"" should be placed before local imports ""package.Class"", "".package"", "".package2""":UNDEFINED
77
wrong-import-order:23:0:23:25::"first party import ""pylint.config"" should be placed before local imports ""package.Class"", "".package"", "".package2""":UNDEFINED
88
wrong-import-order:24:0:24:17::"first party import ""pylint.sys"" should be placed before local imports ""package.Class"", "".package"", "".package2""":UNDEFINED
99
wrong-import-order:25:0:25:28::"first party import ""pylint.pyreverse"" should be placed before local imports ""package.Class"", "".package"", "".package2""":UNDEFINED
1010
wrong-import-order:30:0:30:40::"third party import ""six.moves.urllib.parse.quote"" should be placed before first party imports ""pylint.checkers"", ""pylint.config"", ""pylint.sys"", ""pylint.pyreverse"" and local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
1111
wrong-import-order:31:0:31:23::"first party import ""pylint.constants"" should be placed before local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
12-
wrong-import-order:32:0:32:19::"standard import ""re"" should be placed before third party imports ""six"", ""astroid.are_exclusive"", ""unused_import"", ""totally_missing"", ""astroid"", ""six.moves.urllib.parse.quote"", first party imports ""pylint.checkers"", ""pylint.config"", ""pylint.sys"", ""pylint.pyreverse"", ""pylint.constants"", and local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
12+
wrong-import-order:32:0:32:19::"standard import ""re"" should be placed before third party imports ""six"", ""pytest.mark"", ""unused_import"", ""totally_missing"", ""pytest"", ""six.moves.urllib.parse.quote"", first party imports ""pylint.checkers"", ""pylint.config"", ""pylint.sys"", ""pylint.pyreverse"", ""pylint.constants"", and local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
1313
wrong-import-order:32:0:32:19::"third party import ""requests"" should be placed before first party imports ""pylint.checkers"", ""pylint.config"", ""pylint.sys"", ""pylint.pyreverse"", ""pylint.constants"" and local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
1414
wrong-import-order:33:0:33:24::"first party import ""pylint.exceptions"" should be placed before local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
1515
wrong-import-order:34:0:34:21::"first party import ""pylint.message"" should be placed before local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
16-
wrong-import-order:35:0:35:11::"standard import ""time"" should be placed before third party imports ""six"", ""astroid.are_exclusive"", ""unused_import"" (...) ""astroid"", ""six.moves.urllib.parse.quote"", ""requests"", first party imports ""pylint.checkers"", ""pylint.config"", ""pylint.sys"" (...) ""pylint.constants"", ""pylint.exceptions"", ""pylint.message"", and local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED
16+
wrong-import-order:35:0:35:11::"standard import ""time"" should be placed before third party imports ""six"", ""pytest.mark"", ""unused_import"" (...) ""pytest"", ""six.moves.urllib.parse.quote"", ""requests"", first party imports ""pylint.checkers"", ""pylint.config"", ""pylint.sys"" (...) ""pylint.constants"", ""pylint.exceptions"", ""pylint.message"", and local imports ""package.Class"", "".package"", "".package2"" (...) ""package3.Class3"", "".package4"", ""package4.Class4""":UNDEFINED

0 commit comments

Comments
 (0)