comparison tests/test-module-imports.t @ 26964:5abba2c92da3

import-checker: allow import of child modules from package root I got the following error by rewriting hgweb/__init__.py to use absolute_import, which is obviously wrong: Import cycle: mercurial.hgweb.__init__ -> mercurial.hgweb.__init__ "from foo import bar" should not make a cycle if "foo" is a package and if "bar" is a module or a package. On the other hand, it should be detected as a cycle if "bar" is a non-module name. Both cases are doc-tested already, so this patch does not add new doctest.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Nov 2015 00:37:22 +0900
parents 4b56214ebb7a
children 1fa66d3ad28d
comparison
equal deleted inserted replaced
26963:de5ae97ce9f4 26964:5abba2c92da3
66 > from __future__ import absolute_import 66 > from __future__ import absolute_import
67 > from . import foo 67 > from . import foo
68 > from .. import parent 68 > from .. import parent
69 > EOF 69 > EOF
70 70
71 $ touch testpackage/subpackage/foo.py
72 $ cat > testpackage/subpackage/__init__.py << EOF
73 > from __future__ import absolute_import
74 > from . import levelpriority # should not cause cycle
75 > EOF
76
71 $ cat > testpackage/sortedentries.py << EOF 77 $ cat > testpackage/sortedentries.py << EOF
72 > from __future__ import absolute_import 78 > from __future__ import absolute_import
73 > from . import ( 79 > from . import (
74 > foo, 80 > foo,
75 > bar, 81 > bar,