Commits

Marc Abramowitz committed fc2decf

Put six.moves modules in sys.modules so that they're importable (fixes
#19)

  • Participants
  • Parent commits 7f23989
  • Branches issue_19

Comments (0)

Files changed (2)

 ]
 for attr in _moved_attributes:
     setattr(_MovedItems, attr.name, attr)
+    if isinstance(attr, MovedModule):
+        sys.modules[__name__ + ".moves." + attr.name] = attr
 del attr
 
 moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves")
 def test_move_items(item_name):
     """Ensure that everything loads correctly."""
     try:
-        getattr(six.moves, item_name)
+        item = getattr(six.moves, item_name)
+        if isinstance(item, types.ModuleType):
+            __import__("six.moves." + item_name)
     except AttributeError:
         if item_name == "zip_longest" and sys.version_info < (2, 6):
             py.test.skip("zip_longest only available on 2.6+")