def test_pkg_fetch_render(self, mlinked, mindex, mfetched, mpkg, mrender): with self.temp_dir() as target: create_rpmbuild_for_env(self.pkgs, target, self.config) spec_dir = os.path.join(target, 'SPECS') self.assertTrue(os.path.isdir(spec_dir)) expected = [ call(['url1'], use_cache=False), call(['url2'], use_cache=False) ] self.assertEqual(mindex.call_args_list, expected) srcs_dir = os.path.join(target, 'SOURCES') expected = [call(srcs_dir, 'pkg1'), call(srcs_dir, 'pkg2')] self.assertEqual(mfetched.call_args_list, expected) expected = [ call(sentinel.pkg1_info, srcs_dir), call(sentinel.pkg2_info, srcs_dir) ] self.assertEqual(mpkg.call_args_list, expected) expected = [ call(os.path.join(srcs_dir, 'pkg1.tar.bz2'), self.config), call(os.path.join(srcs_dir, 'pkg2.tar.bz2'), self.config) ] self.assertEqual(mrender.call_args_list, expected) fname = '{}-pkg-{}.spec' specs = [ os.path.join(spec_dir, fname.format(self.prefix, 'pkg1')), os.path.join(spec_dir, fname.format(self.prefix, 'pkg2')) ] for spec in specs: self.assertTrue(os.path.isfile(spec))
def test_pkg_all_linked(self): func = 'conda_rpms.install.linked' with patch(func, return_value=zip(*self.pkgs)[1]): with self.temp_dir() as target: create_rpmbuild_for_env(self.pkgs, target, self.config) spec_dir = os.path.join(target, 'SPECS') self.assertFalse(os.path.isdir(spec_dir))
def test_pkg_fetch_render(self, mlinked, mindex, mfetched, mpkg, mrender): with self.temp_dir() as target: create_rpmbuild_for_env(self.pkgs, target, self.config) spec_dir = os.path.join(target, 'SPECS') self.assertTrue(os.path.isdir(spec_dir)) expected = [call(['url1'], use_cache=False), call(['url2'], use_cache=False)] self.assertEqual(mindex.call_args_list, expected) srcs_dir = os.path.join(target, 'SOURCES') expected = [call(srcs_dir, 'pkg1'), call(srcs_dir, 'pkg2')] self.assertEqual(mfetched.call_args_list, expected) expected = [call(sentinel.pkg1_info, srcs_dir), call(sentinel.pkg2_info, srcs_dir)] self.assertEqual(mpkg.call_args_list, expected) expected = [call(os.path.join(srcs_dir, 'pkg1.tar.bz2'), self.config), call(os.path.join(srcs_dir, 'pkg2.tar.bz2'), self.config)] self.assertEqual(mrender.call_args_list, expected) fname = '{}-pkg-{}.spec' specs = [os.path.join(spec_dir, fname.format(self.prefix, 'pkg1')), os.path.join(spec_dir, fname.format(self.prefix, 'pkg2'))] for spec in specs: self.assertTrue(os.path.isfile(spec))
def test_pkg_all_linked(self): func = 'conda_rpms.install.linked' with patch(func, return_value=zip(*self.pkgs)[1]): with self.temp_dir() as target: create_rpmbuild_for_env(self.pkgs, target, self.config) spec_dir = os.path.join(target, 'SPECS') self.assertFalse(os.path.isdir(spec_dir))
def test_pkg_unavailable(self, mlinked, mindex): with self.temp_dir() as target: emsg = 'no longer available in the channel' with self.assertRaisesRegexp(ValueError, emsg): create_rpmbuild_for_env(self.pkgs, target, self.config)
def test_pkg_unavailable(self, mlinked, mindex): with self.temp_dir() as target: emsg = 'no longer available in the channel' with self.assertRaisesRegexp(ValueError, emsg): create_rpmbuild_for_env(self.pkgs, target, self.config)