diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-01-04 17:35:43 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-01-04 17:35:43 -0600 |
commit | 7650f8beb6cf9d5d8c8f722cf09df888d278af86 (patch) | |
tree | 56e0a7f68668cef4f4d606290bf154dae05e21b8 /test_six.py | |
parent | f2622c16be1e9362a1b8b5b75b8bd9e4da60a498 (diff) | |
parent | f293ede1501e852dd16922eb33f6ede9d69edcc6 (diff) | |
download | six-7650f8beb6cf9d5d8c8f722cf09df888d278af86.tar.gz |
Merged in msabramo/six/issue_19 (pull request #18)
Put six.moves modules in sys.modules so that they're importable (fixes
Diffstat (limited to 'test_six.py')
-rw-r--r-- | test_six.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test_six.py b/test_six.py index e6e75dd..14f0e7e 100644 --- a/test_six.py +++ b/test_six.py @@ -96,7 +96,9 @@ except ImportError: 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+") @@ -183,6 +185,16 @@ def test_import_moves_error_3(): from six.moves.urllib_parse import urljoin +def test_from_six_moves_queue_import_Queue(): + from six.moves.queue import Queue + assert isinstance(Queue, types.ClassType) + + +def test_from_six_moves_configparser_import_ConfigParser(): + from six.moves.configparser import ConfigParser + assert isinstance(ConfigParser, types.ClassType) + + def test_filter(): from six.moves import filter f = filter(lambda x: x % 2, range(10)) |