示例#1
0
文件: test.py 项目: conda/conda-api
    def test_install(self):
        try:
            for pkgset in (['python=3.4'], ['python=3.4.0']):
                result = conda_api.install(pkgs=pkgset, path=self.prefix)
        except conda_api.CondaError as e:
            self.fail("install fails: %s" % e)

        for pkg in conda_api.linked(self.prefix):
            info = conda_api.package_info(pkg + '.tar.bz2')
            # info isn't necessarily complete because conda info only checks
            # prefixes in default prefix dirs and there isn't a way to
            # specify a prefix to check yet
            self.assertIn(pkg + '.tar.bz2', info)

        try:
            result = conda_api.update('python', path=self.prefix)
            self.assertIn('success', result)
            self.assertTrue(result['success'])
        except conda_api.CondaError as e:
            self.fail("update fails: %s" % e)

        linked = conda_api.linked(self.prefix)
        self.assertIsInstance(linked, set)
        self.assertTrue(any('python' in pkg for pkg in linked))

        try:
            result = conda_api.remove('python', path=self.prefix)
            self.assertIn('success', result)
            self.assertTrue(result['success'])
        except conda_api.CondaError as e:
            self.fail("update fails: %s" % e)

        self.assertRaises(TypeError, lambda: conda_api.install(path=self.prefix))
        self.assertRaises(TypeError, lambda: conda_api.update(path=self.prefix))
示例#2
0
 def test_envs(self):
     self.assertIsInstance(conda_api.get_envs(), list)
     try:
         path = os.path.join(tempfile.mkdtemp(), 'conda_api_test')
         clone = os.path.join(tempfile.mkdtemp(), 'conda_api_test_clone')
         conda_api.create(path=path, pkgs=['python'])
         conda_api.clone_environment(path, path=clone)
         self.assertEqual(conda_api.linked(path), conda_api.linked(clone))
         conda_api.remove_environment(path=path)
         conda_api.remove_environment(path=clone)
     except Exception as e:
         self.fail('create/remove fails: %s' % e)
示例#3
0
文件: test.py 项目: conda/conda-api
 def test_envs(self):
     self.assertIsInstance(conda_api.get_envs(), list)
     try:
         path = os.path.join(tempfile.mkdtemp(), 'conda_api_test')
         clone = os.path.join(tempfile.mkdtemp(), 'conda_api_test_clone')
         conda_api.create(path=path, pkgs=['python'])
         conda_api.clone_environment(path, path=clone)
         self.assertEqual(conda_api.linked(path), conda_api.linked(clone))
         conda_api.remove_environment(path=path)
         conda_api.remove_environment(path=clone)
     except Exception as e:
         self.fail('create/remove fails: %s' % e)
示例#4
0
def get_packages(prefix):
	'''get packages with linked function'''
	linked_packages = conda.linked(prefix)

	pkgs = [{'name': pkg.rsplit('-', 2)[0],
			 'version': pkg.rsplit('-', 2)[1],
			 'build': pkg.rsplit('-', 2)[2]} for pkg in linked_packages]

	return(pkgs)
示例#5
0
    def test_install(self):
        try:
            for pkgset in (['python=3.4'], ['python=3.4.0']):
                result = conda_api.install(pkgs=pkgset, path=self.prefix)
        except conda_api.CondaError as e:
            self.fail("install fails: %s" % e)

        for pkg in conda_api.linked(self.prefix):
            info = conda_api.package_info(pkg + '.tar.bz2')
            # info isn't necessarily complete because conda info only checks
            # prefixes in default prefix dirs and there isn't a way to
            # specify a prefix to check yet
            self.assertIn(pkg + '.tar.bz2', info)

        try:
            result = conda_api.update('python', path=self.prefix)
            self.assertIn('success', result)
            self.assertTrue(result['success'])
        except conda_api.CondaError as e:
            self.fail("update fails: %s" % e)

        linked = conda_api.linked(self.prefix)
        self.assertIsInstance(linked, set)
        self.assertTrue(any('python' in pkg for pkg in linked))

        try:
            result = conda_api.remove('python', path=self.prefix)
            self.assertIn('success', result)
            self.assertTrue(result['success'])
        except conda_api.CondaError as e:
            self.fail("update fails: %s" % e)

        self.assertRaises(TypeError,
                          lambda: conda_api.install(path=self.prefix))
        self.assertRaises(TypeError,
                          lambda: conda_api.update(path=self.prefix))