Closed
Description
Trying to rebuild astroid master (due to the lack of a release and multiple failures with the stable release -- I was trying to see if the impending 2.0.0 release would fix it) for python 3.7 on Arch Linux, I hit the following testsuite error:
=================================== FAILURES ===================================
______________ GetModuleFilesTest.test_load_module_set_attribute _______________
self = <astroid.tests.unittest_modutils.GetModuleFilesTest testMethod=test_load_module_set_attribute>
def test_load_module_set_attribute(self):
import xml.etree.ElementTree
import xml
del xml.etree.ElementTree
del sys.modules['xml.etree.ElementTree']
> m = modutils.load_module_from_modpath(['xml', 'etree', 'ElementTree'])
astroid/tests/unittest_modutils.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astroid/modutils.py:231: in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
/usr/lib/python3.7/imp.py:235: in load_module
return load_source(name, filename, file)
/usr/lib/python3.7/imp.py:172: in load_source
module = _load(spec)
<frozen importlib._bootstrap>:696: in _load
???
<frozen importlib._bootstrap>:677: in _load_unlocked
???
<frozen importlib._bootstrap_external>:724: in exec_module
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <imp._LoadSourceCompatibility object at 0x7fe448e1acf8>
fullname = 'xml.etree.ElementTree'
> ???
E TypeError: a bytes-like object is required, not 'str'
<frozen importlib._bootstrap_external>:838: TypeError
======== 1 failed, 801 passed, 48 skipped, 10 xfailed in 21.08 seconds =========
I actually get more errors trying to rebuild master on python 3.6:
=================================== FAILURES ===================================
___________________________ test_type_comments_with ____________________________
@pytest.mark.skipif(not HAS_TYPED_AST, reason="requires typed_ast")
def test_type_comments_with():
module = builder.parse('''
with a as b: # type: int
pass
with a as b: # type: ignore
pass
''')
node = module.body[0]
ignored_node = module.body[1]
> assert isinstance(node.type_annotation, astroid.Name)
E AssertionError: assert False
E + where False = isinstance(None, <class 'astroid.node_classes.Name'>)
E + where None = <With l.2 at 0x7f8ab1ddb400>.type_annotation
E + and <class 'astroid.node_classes.Name'> = astroid.Name
astroid/tests/unittest_nodes.py:863: AssertionError
____________________________ test_type_comments_for ____________________________
@pytest.mark.skipif(not HAS_TYPED_AST, reason="requires typed_ast")
def test_type_comments_for():
module = builder.parse('''
for a, b in [1, 2, 3]: # type: List[int]
pass
for a, b in [1, 2, 3]: # type: ignore
pass
''')
node = module.body[0]
ignored_node = module.body[1]
> assert isinstance(node.type_annotation, astroid.Subscript)
E AssertionError: assert False
E + where False = isinstance(None, <class 'astroid.node_classes.Subscript'>)
E + where None = <For l.2 at 0x7f8ab1e6bcf8>.type_annotation
E + and <class 'astroid.node_classes.Subscript'> = astroid.Subscript
astroid/tests/unittest_nodes.py:878: AssertionError
___________________________ test_type_coments_assign ___________________________
@pytest.mark.skipif(not HAS_TYPED_AST, reason="requires typed_ast")
def test_type_coments_assign():
module = builder.parse('''
a, b = [1, 2, 3] # type: List[int]
a, b = [1, 2, 3] # type: ignore
''')
node = module.body[0]
ignored_node = module.body[1]
> assert isinstance(node.type_annotation, astroid.Subscript)
E AssertionError: assert False
E + where False = isinstance(None, <class 'astroid.node_classes.Subscript'>)
E + where None = <Assign l.2 at 0x7f8ab1dd07b8>.type_annotation
E + and <class 'astroid.node_classes.Subscript'> = astroid.Subscript
astroid/tests/unittest_nodes.py:892: AssertionError
_________________________ test_type_comments_function __________________________
@pytest.mark.skipif(not HAS_TYPED_AST, reason="requires typed_ast")
def test_type_comments_function():
module = builder.parse('''
def func():
# type: (int) -> str
pass
def func1():
# type: (int, int, int) -> (str, str)
pass
def func2():
# type: (int, int, str, List[int]) -> List[int]
pass
''')
expected_annotations = [
(["int"], astroid.Name, "str"),
(["int", "int", "int"], astroid.Tuple, "(str, str)"),
(["int", "int", "str", "List[int]"], astroid.Subscript, "List[int]"),
]
for node, (
expected_args,
expected_returns_type,
expected_returns_string
) in zip(module.body, expected_annotations):
> assert node.type_comment_returns is not None
E assert None is not None
E + where None = <FunctionDef.func l.2 at 0x7f8ab1ea7860>.type_comment_returns
astroid/tests/unittest_nodes.py:950: AssertionError
======== 4 failed, 803 passed, 43 skipped, 10 xfailed in 23.47 seconds =========
Metadata
Metadata
Assignees
Labels
No labels