Closed FRidh closed 3 years ago
============================= test session starts ============================== platform linux -- Python 3.7.4, pytest-5.1.0, py-1.8.0, pluggy-0.12.0 apipkg full install version=1.5 rootdir: /build/apipkg-1.5 collected 37 items test_apipkg.py ...................F............F.... [100%] =================================== FAILURES =================================== ________________________ test_error_loading_one_element ________________________ monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffff591be10> tmpdir = local('/build/pytest-of-nixbld/pytest-0/test_error_loading_one_element0') def test_error_loading_one_element(monkeypatch, tmpdir): pkgdir = tmpdir.mkdir("errorloading1") pkgdir.join('__init__.py').write(py.code.Source(""" import apipkg apipkg.initpkg(__name__, exportdefs={ 'x': '.notexists:x', 'y': '.submod:y' }, ) """)) pkgdir.join('submod.py').write("y=0") monkeypatch.syspath_prepend(tmpdir) import errorloading1 assert isinstance(errorloading1, apipkg.ApiModule) assert errorloading1.y == 0 > py.test.raises(ImportError, 'errorloading1.x') E TypeError: 'errorloading1.x' object (type: <class 'str'>) must be callable test_apipkg.py:322: TypeError ________________________ test_aliasmodule_proxy_methods ________________________ tmpdir = local('/build/pytest-of-nixbld/pytest-0/test_aliasmodule_proxy_methods0') monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffff73e9cd0> def test_aliasmodule_proxy_methods(tmpdir, monkeypatch): pkgdir = tmpdir pkgdir.join('aliasmodule_proxy.py').write(py.code.Source(""" def doit(): return 42 """)) pkgdir.join('my_aliasmodule_proxy.py').write(py.code.Source(""" import apipkg apipkg.initpkg(__name__, dict(proxy='aliasmodule_proxy')) def doit(): return 42 """)) monkeypatch.syspath_prepend(tmpdir) import aliasmodule_proxy as orig from my_aliasmodule_proxy import proxy doit = proxy.doit assert doit is orig.doit del proxy.doit > py.test.raises(AttributeError, "orig.doit") E TypeError: 'orig.doit' object (type: <class 'str'>) must be callable test_apipkg.py:496: TypeError ========================= 2 failed, 35 passed in 0.29s ========================= builder for '/nix/store/mfm3g4mjlc3lx1irxd8fdh67l87zmdw4-python3.7-apipkg-1.5.drv' failed with exit code 1 error: build of '/nix/store/mfm3g4mjlc3lx1irxd8fdh67l87zmdw4-python3.7-apipkg-1.5.drv' failed
fixed by #9