summaryrefslogtreecommitdiff
path: root/test/data
diff options
context:
space:
mode:
authorAurelien Campeas <aurelien.campeas@logilab.fr>2012-07-30 11:22:03 +0200
committerAurelien Campeas <aurelien.campeas@logilab.fr>2012-07-30 11:22:03 +0200
commit62126b894bc1d1c6a88db5bf4cae86ea20b48d6e (patch)
tree91711fee01fc8f182c89b5001996d7a9010d76ee /test/data
parent507c60ba25e29654ec1a6245d684fb0d96dd12b5 (diff)
downloadlogilab-common-62126b894bc1d1c6a88db5bf4cae86ea20b48d6e.tar.gz
[modutils] fix load_module_from_path (closes #100935)
A very old bug in modutils, that leads to doubly loading some modules. By chance on Linux (or the platform we typically use) it seems one the two module gets forgoten as soon as loaded. Unfortunately on Windows, with CubicWeb, it was found that the first module instance was the one on which the mro was built and the second one hosted the super(...) call with a different class id for the litteral within super(ThisClass, self).... The exact reason for the dual behaviour is still unknown but it could well be one of those 'platform dependant' bits that riddle Python.
Diffstat (limited to 'test/data')
-rw-r--r--test/data/lmfp/__init__.py2
-rw-r--r--test/data/lmfp/foo.py6
2 files changed, 8 insertions, 0 deletions
diff --git a/test/data/lmfp/__init__.py b/test/data/lmfp/__init__.py
new file mode 100644
index 0000000..74b26b8
--- /dev/null
+++ b/test/data/lmfp/__init__.py
@@ -0,0 +1,2 @@
+# force a "direct" python import
+from . import foo
diff --git a/test/data/lmfp/foo.py b/test/data/lmfp/foo.py
new file mode 100644
index 0000000..8f7de1e
--- /dev/null
+++ b/test/data/lmfp/foo.py
@@ -0,0 +1,6 @@
+import sys
+if not getattr(sys, 'bar', None):
+ sys.just_once = []
+# there used to be two numbers here because
+# of a load_module_from_path bug
+sys.just_once.append(42)