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' ])
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)])
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
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' ) ])
def test_custom_req(self): package_manager.install_lib('foo', { 'install_with': 'easy_install' }) self.assertEqual(run_commands(), ['easy_install foo'])
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)])
def test_skip_install(self): package_manager.install_lib('projectenv', {}) self.assertEqual(run_commands(), [])