def test_upgrade(self): """Make sure peep installing a GitHub-sourced tarball installs it, even if its version hasn't changed. """ try: activate('pip>=1.0.1') except RuntimeError: raise SkipTest("This version of pip is so old that #egg= parsing " "doesn't work right.") # Install an old version: self.install_from_string( """# sha256: Q7PVYWdV3NFZ3bkx5bNmUd74UTCe7jrwf2AeM4wUD1A {index_url}useless/1234567.zip#egg=useless""".format( index_url=self.index_url())) # Make sure it worked: import useless reload(useless) # in case another test imports it first eq_(useless.git_hash, '1234567') # Install the new version: self.install_from_string( """# sha256: JIAjkT1OSM1PIxLbvKk46W4iOTqH9yHASHTwvGVEC4k {index_url}useless/789abcd.zip#egg=useless""".format( index_url=self.index_url())) # Make sure the new version is really installed: reload(useless) eq_(useless.git_hash, '789abcd') # Clean up: run('pip uninstall -y useless')
def test_port(self): """Test peep port.""" # We can't get the package name from URL-based requirements before pip # 1.0. Tolerate it so we can at least test everything else: try: activate('pip>=6.1.0') except RuntimeError: try: activate('pip>=1.0.1') except RuntimeError: schema_package_name = 'None' else: schema_package_name = 'schema' else: schema_package_name = 'https://github.com/erikrose/schema/archive/99dc4130f0f05fd3c2d4bc6663a2419851f3c90f.zip#egg=schema' reqs = """ # sha256: Jo-gDCfedW1xZj3WH3OkqNhydWm7G0dLLOYCBVOCaHI # sha256: mXhebPcVzc3lne4FpnbpnwSDWnHnztIByjF0AcMiupY certifi==2015.04.28 # Those were 2 hashes! # A comment above hash # sha256: mrHTE_mbIJ-PcaYp82gzAwyNfHIoLPd1aDS69WfcpmI # A comment between hash and package click==4.0 # No hash: configobj==5.0.6 # sha256: mEFMy7mQkCOXKZaP5CJaMXPj8OwbteW9dmq9drwZqNk https://github.com/erikrose/schema/archive/99dc4130f0f05fd3c2d4bc6663a2419851f3c90f.zip#egg=schema """ with requirements(reqs) as reqs_path: result = run('{python} {peep} port {reqs}', python=python_path(), peep=peep_path(), reqs=reqs_path).decode('ascii') expected = ( '\n# from {reqs_path}\n\n' 'certifi==2015.04.28 \\\n' ' --hash=sha256:268fa00c27de756d71663dd61f73a4a8d8727569bb1b474b2ce6020553826872 \\\n' ' --hash=sha256:99785e6cf715cdcde59dee05a676e99f04835a71e7ced201ca317401c322ba96\n' 'click==4.0 \\\n' ' --hash=sha256:9ab1d313f99b209f8f71a629f36833030c8d7c72282cf7756834baf567dca662\n' 'configobj==5.0.6\n' '{schema} \\\n' ' --hash=sha256:98414ccbb99090239729968fe4225a3173e3f0ec1bb5e5bd766abd76bc19a8d9\n' ''.format(schema=schema_package_name, reqs_path=reqs_path)) eq_(result, expected)
def test_missing_requirements_file(self): """Check that pip's InstallationError exception (when the specified requirements file doesn't exist) is handled gracefully.""" try: activate('pip>=0.8.3') except RuntimeError: raise SkipTest("This version of pip is so old that it doesn't even " "handle the IOError opening the file itself properly.") with running_setup_py(False): try: self.install_from_path('nonexistent.txt') except CalledProcessError as exc: eq_(exc.returncode, SOMETHING_WENT_WRONG) else: self.fail("Peep exited successfully but shouldn't have.")
def test_missing_requirements_file(self): """Check that pip's InstallationError exception (when the specified requirements file doesn't exist) is handled gracefully.""" try: activate('pip>=0.8.3') except RuntimeError: raise SkipTest( "This version of pip is so old that it doesn't even " "handle the IOError opening the file itself properly.") with running_setup_py(False): try: self.install_from_path('nonexistent.txt') except CalledProcessError as exc: eq_(exc.returncode, SOMETHING_WENT_WRONG) else: self.fail("Peep exited successfully but shouldn't have.")