def get_dsa(fsroot, pkgname): py.std.sys.path.insert(0, str(fsroot)) pkg = __import__(pkgname) ds = DocStorage() ds.from_pkg(pkg) dsa = DocStorageAccessor(ds) return ds, dsa
def test_add_desc(): ds = DocStorage().from_dict({}) ds.add_desc("one", fun) ds.add_desc("one", other_fun) assert sorted(ds.descs.keys()) == ["one", "one_1"] assert isinstance(ds.descs["one"], FunctionDesc) assert isinstance(ds.descs["one_1"], FunctionDesc) assert ds.descs["one"].pyobj is fun assert ds.descs["one_1"].pyobj is other_fun assert ds.desc_cache[ds.descs["one"]] is ds.descs["one"] assert ds.desc_cache[ds.descs["one_1"]] is ds.descs["one_1"]