Beispiel #1
0
    def test_tryimport(self):
        """
        Test that try-import don't crash on trailing dot, and import modules before
        """
        from IPython.core.completerlib import try_import

        assert try_import("IPython.")
Beispiel #2
0
def test_module_without_init():
    """
    Test module without __init__.py.
    
    https://github.com/ipython/ipython/issues/11226
    """
    fake_module_name = "foo"
    with TemporaryDirectory() as tmpdir:
        sys.path.insert(0, tmpdir)
        try:
            os.makedirs(os.path.join(tmpdir, fake_module_name))
            s = try_import(mod=fake_module_name)
            assert s == []
        finally:
            sys.path.remove(tmpdir)
Beispiel #3
0
def test_tryimport():
    """
    Test that try-import don't crash on trailing dot, and import modules before
    """
    from IPython.core.completerlib import try_import
    assert(try_import("IPython."))