Exemplo n.º 1
0
def test_get_module_path_by_module_string_abs():
    from os.path import dirname, join
    from xoutil.modules import get_module_path
    top = join(dirname(dirname(__file__)), 'xoutil')
    expected = top
    assert get_module_path('xoutil') == expected

    expected = (join(top, 'iterators.py'),
                join(top, 'iterators.pyc'),
                join(top, 'iterators.pyo'))
    assert get_module_path('xoutil.iterators') in expected
Exemplo n.º 2
0
def test_get_module_path_by_module_string_abs():
    import xoutil
    from os.path import join
    from xoutil.modules import get_module_path
    top = xoutil.__path__[0]
    expected = top
    assert get_module_path('xoutil') == expected
    expected = (join(top, 'iterators.py'),
                join(top, 'iterators.pyc'),
                join(top, 'iterators.pyo'))
    assert get_module_path('xoutil.iterators') in expected
Exemplo n.º 3
0
def test_get_module_path_by_module_object():
    import xoutil, xoutil.iterators
    from os.path import dirname, join
    from xoutil.modules import get_module_path
    top = join(dirname(dirname(__file__)), 'xoutil')
    expected = top
    assert get_module_path(xoutil) == expected

    expected = (join(top, 'iterators.py'),
                join(top, 'iterators.pyc'),
                join(top, 'iterators.pyo'))
    assert get_module_path(xoutil.iterators) in expected
Exemplo n.º 4
0
def test_get_module_path_by_module_object():
    import xoutil
    import xoutil.iterators
    from os.path import join
    from xoutil.modules import get_module_path
    top = xoutil.__path__[0]
    expected = top
    assert get_module_path(xoutil) == expected

    expected = (join(top, 'iterators.py'),
                join(top, 'iterators.pyc'),
                join(top, 'iterators.pyo'))
    assert get_module_path(xoutil.iterators) in expected
Exemplo n.º 5
0
def test_get_module_path_by_module_string_rel():
    import pytest
    from xoutil.modules import get_module_path
    with pytest.raises(TypeError):
        assert get_module_path('.iterators') == expected