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
def test_name_attribute(): api = apipkg.ApiModule( "name_test", { "subpkg": {}, }, ) assert api.__name__ == "name_test" assert api.subpkg.__name__ == "name_test.subpkg"
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
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
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
def test_name_attribute(): api = apipkg.ApiModule('name_test', { 'subpkg': {}, }) assert api.__name__ == 'name_test' assert api.subpkg.__name__ == 'name_test.subpkg'