def test_can_invoke_pip(self):
     pip = SubprocessPip(python_exe=sys.executable)
     rc, out, err = pip.main(["--version"])
     # Simple assertion that we can execute pip and it gives us some output
     # and nothing on stderr.
     assert rc == 0
     assert err == b""
Esempio n. 2
0
    def test_check_pip_runner_string_pip(self):
        fake_osutils = FakePopenOSUtils([FakePopen(0, "", "")])
        pip = SubprocessPip(osutils=fake_osutils, python_exe=sys.executable)
        pip.main(["--version"])

        pip_runner_string = fake_osutils.popens[0][0][0][2].split(";")[-1:][0]
        self.assertIn("main", pip_runner_string)
Esempio n. 3
0
 def test_can_invoke_pip(self):
     pip = SubprocessPip()
     rc, out, err = pip.main(['--version'])
     # Simple assertion that we can execute pip and it gives us some output
     # and nothing on stderr.
     assert rc == 0
     assert err == b''
 def test_does_error_code_propagate(self):
     pip = SubprocessPip(python_exe=sys.executable)
     rc, _, err = pip.main(["badcommand"])
     assert rc != 0
     # Don't want to depend on a particular error message from pip since it
     # may change if we pin a differnet version to Chalice at some point.
     # But there should be a non-empty error message of some kind.
     assert err != b""
Esempio n. 5
0
    def test_does_use_custom_pip_import_string(self):
        fake_osutils = FakePopenOSUtils([FakePopen(0, "", "")])
        expected_import_statement = "foobarbaz"
        pip = SubprocessPip(osutils=fake_osutils, import_string=expected_import_statement, python_exe=sys.executable)
        pip.main(["--version"])

        pip_execution_string = fake_osutils.popens[0][0][0][2]
        import_statement = pip_execution_string.split(";")[1].strip()
        assert import_statement == expected_import_statement
    def test_does_use_custom_pip_import_string(self):
        fake_osutils = FakePopenOSUtils([FakePopen(0, '', '')])
        expected_import_statement = 'foobarbaz'
        pip = SubprocessPip(osutils=fake_osutils,
                            import_string=expected_import_statement)
        pip.main(['--version'])

        pip_execution_string = fake_osutils.popens[0][0][0][2]
        import_statement = pip_execution_string.split(';')[1].strip()
        assert import_statement == expected_import_statement
 def test_can_invoke_pip(self):
     pip = SubprocessPip(python_exe=sys.executable)
     rc, _, _ = pip.main(["--version"])
     # Simple assertion that we can execute pip
     assert rc == 0