def test_create_exe(self): # FIXME: do a real test here meta, sections, nodes = create_simple_ipkg_args(self.top_node) ipkg = InstalledPkgDescription(sections, meta, {}) fid, arcname = tempfile.mkstemp(prefix="zip") try: create_exe(ipkg, arcname, "some-name.exe") finally: os.close(fid)
def test_simple_roundtrip(self): # FIXME: we compare the loaded json to avoid dealing with encoding # differences when comparing objects, but this is kinda stupid r_ipkg = InstalledPkgDescription(self.sections, self.meta, {}) f = StringIO() r_ipkg._write(f) r_s = f.getvalue() ipkg = InstalledPkgDescription.from_string(r_s) f = StringIO() ipkg._write(f) s = f.getvalue() self.assertEqual(json.loads(r_s), json.loads(s))
def test_simple(self): ipkg = InstalledPkgDescription(self.sections, self.meta, {}) sections = ipkg.resolve_paths(self.top_node) res = sorted([(kind, source.abspath(), target.abspath()) \ for kind, source, target in iter_files(sections)]) target_dir = ipkg.resolve_path(os.path.join("$prefix", "target")) ref = [("pythonfiles", os.path.join(self.top_node.abspath(), "source", "scripts", "bar.py"), os.path.join(target_dir, "scripts", "bar.py")), ("pythonfiles", os.path.join(self.top_node.abspath(), "source", "scripts", "foo.py"), os.path.join(target_dir, "scripts", "foo.py"))] self.assertEqual(res, ref)
def test_simple(self): """This just tests whether create_wininst runs at all and produces a zip-file.""" ipackage = InstalledPkgDescription({}, { "name": "foo", "version": "1.0" }, {}) create_wininst(ipackage, self.build_node, self.build_node, wininst="foo.exe", output_dir="dist") arcname = bento.commands.build_wininst.create_exe.call_args[0][1] fp = zipfile.ZipFile(arcname) try: fp.namelist() finally: fp.close()
def store(self, filename, pkg): meta = ipkg_meta_from_pkg(pkg) p = InstalledPkgDescription(self.sections, meta, pkg.executables) if not op.exists(op.dirname(filename)): os.makedirs(op.dirname(filename)) p.write(filename)
def test_get_inidata_run(self): """Simply execute get_inidata.""" # FIXME: do a real test here meta, sections, nodes = create_simple_ipkg_args(self.top_node) ipkg = InstalledPkgDescription(sections, meta, {}) get_inidata(ipkg)
def test_simple_create(self): InstalledPkgDescription(self.sections, self.meta, {})