示例#1
0
 def test_post_install(self):
     package_manager.install_lib('foo', {
         'post_install': [['cp', 'foo', 'bar']]
     })
     self.assertTrue(os.path.exists(self.req_path))
     self.assertEqual(reqlist(self.req_path), ['foo'])
     self.assertEqual(run_commands(), [
         'pip install -E %s -r %s' % (self.test_env, self.req_path),
         'cp foo bar'
     ])
示例#2
0
 def test_path_req(self):
     cwd = os.getcwd()
     lib_path = os.path.join(self.test_env, 'foo', 'bar')
     os.makedirs(lib_path)
     package_manager.install_lib('bar', {'path': lib_path})
     self.assertTrue(os.path.exists(self.req_path))
     self.assertEqual(reqlist(self.req_path), [
         '-e %s' % lib_path
     ])
     self.assertEqual(run_commands(), ['pip install -E %s -r %s' % (
         self.test_env, self.req_path)])
示例#3
0
 def test_git_req(self):
     cwd = os.getcwd()
     os.makedirs(os.path.join(self.test_env, 'src', 'foo'))
     package_manager.install_lib('foo', {'git': 'ssh://test.repo/foo'})
     self.assertTrue(os.path.exists(self.req_path))
     self.assertEqual(reqlist(self.req_path), [
         '-e git+ssh://test.repo/foo#egg=foo'
     ])
     self.assertEqual(run_commands(), ['pip install -E %s -r %s' % (
         self.test_env, self.req_path)])
     self.assertEqual(os.getcwd(), cwd) # ensure we're back where we started
示例#4
0
    def test_pip_install_with_extra_pypi_servers(self):
        """
        should include --extra-index-url options when additional pypi servers
        are specified in .pypirc

        """
        package_manager.install_lib('foo')
        self.assertEqual(run_commands(), [
            'pip install -E %s -r %s --extra-index-url=%s --extra-index-url=%s' % (
                self.test_env,
                self.req_path,
                'http://localhost:8000/simple',
                'http://pypi.internal.com/simple'
            )
        ])
示例#5
0
 def test_custom_req(self):
     package_manager.install_lib('foo', {
         'install_with': 'easy_install'
     })
     self.assertEqual(run_commands(), ['easy_install foo'])
示例#6
0
 def test_string_req_with_version(self):
     package_manager.install_lib('foo==1.2.3')
     self.assertTrue(os.path.exists(self.req_path))
     self.assertEqual(reqlist(self.req_path), ['foo==1.2.3'])
     self.assertEqual(run_commands(), ['pip install -E %s -r %s' % (
         self.test_env, self.req_path)])
示例#7
0
 def test_skip_install(self):
     package_manager.install_lib('projectenv', {})
     self.assertEqual(run_commands(), [])