Exemplo n.º 1
0
def xtest_nested_absolute_imports():
    apipkg.ApiModule('email', {
        'message2': {
            'Message': 'email.message:Message',
        },
    })
    # nesting is supposed to put nested items into sys.modules
    assert 'email.message2' in sys.modules
Exemplo n.º 2
0
def test_name_attribute():
    api = apipkg.ApiModule(
        "name_test",
        {
            "subpkg": {},
        },
    )
    assert api.__name__ == "name_test"
    assert api.subpkg.__name__ == "name_test.subpkg"
Exemplo n.º 3
0
def test_bpython_getattr_override(tmpdir, monkeypatch):
    def patchgetattr(self, name):
        raise AttributeError(name)

    monkeypatch.setattr(apipkg.ApiModule, '__getattr__', patchgetattr)
    api = apipkg.ApiModule('bpy', {
        'abspath': 'os.path:abspath',
    })
    d = api.__dict__
    assert 'abspath' in d
Exemplo n.º 4
0
def xtest_nested_absolute_imports():
    apipkg.ApiModule(
        "email",
        {
            "message2": {
                "Message": "email.message:Message",
            },
        },
    )
    # nesting is supposed to put nested items into sys.modules
    assert "email.message2" in sys.modules
Exemplo n.º 5
0
def test_bpython_getattr_override(tmpdir, monkeypatch):
    def patchgetattr(self, name):
        raise AttributeError(name)

    monkeypatch.setattr(apipkg.ApiModule, "__getattr__", patchgetattr)
    api = apipkg.ApiModule(
        "bpy",
        {
            "abspath": "os.path:abspath",
        },
    )
    d = api.__dict__
    assert "abspath" in d
Exemplo n.º 6
0
def test_name_attribute():
    api = apipkg.ApiModule('name_test', {
        'subpkg': {},
    })
    assert api.__name__ == 'name_test'
    assert api.subpkg.__name__ == 'name_test.subpkg'