summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_import')
-rw-r--r--Lib/test/test_import/__init__.py10
-rw-r--r--Lib/test/test_import/data/circular_imports/subpkg2/__init__.py0
-rw-r--r--Lib/test/test_import/data/circular_imports/subpkg2/parent/__init__.py1
-rw-r--r--Lib/test/test_import/data/circular_imports/subpkg2/parent/child.py3
4 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index 9744761..e0299c1 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -1350,6 +1350,16 @@ class CircularImportTests(unittest.TestCase):
str(cm.exception),
)
+ def test_absolute_circular_submodule(self):
+ with self.assertRaises(AttributeError) as cm:
+ import test.test_import.data.circular_imports.subpkg2.parent
+ self.assertIn(
+ "cannot access submodule 'parent' of module "
+ "'test.test_import.data.circular_imports.subpkg2' "
+ "(most likely due to a circular import)",
+ str(cm.exception),
+ )
+
def test_unwritable_module(self):
self.addCleanup(unload, "test.test_import.data.unwritable")
self.addCleanup(unload, "test.test_import.data.unwritable.x")
diff --git a/Lib/test/test_import/data/circular_imports/subpkg2/__init__.py b/Lib/test/test_import/data/circular_imports/subpkg2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Lib/test/test_import/data/circular_imports/subpkg2/__init__.py
diff --git a/Lib/test/test_import/data/circular_imports/subpkg2/parent/__init__.py b/Lib/test/test_import/data/circular_imports/subpkg2/parent/__init__.py
new file mode 100644
index 0000000..9745f60
--- /dev/null
+++ b/Lib/test/test_import/data/circular_imports/subpkg2/parent/__init__.py
@@ -0,0 +1 @@
+import test.test_import.data.circular_imports.subpkg2.parent.child
diff --git a/Lib/test/test_import/data/circular_imports/subpkg2/parent/child.py b/Lib/test/test_import/data/circular_imports/subpkg2/parent/child.py
new file mode 100644
index 0000000..1995a37
--- /dev/null
+++ b/Lib/test/test_import/data/circular_imports/subpkg2/parent/child.py
@@ -0,0 +1,3 @@
+import test.test_import.data.circular_imports.subpkg2.parent
+
+test.test_import.data.circular_imports.subpkg2.parent