Skip to content

Commit 84e1a79

Browse files
committed
fix: unit and functional tests
1 parent 47d61a5 commit 84e1a79

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

tests/functional/workflows/python_pip/test_packager.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ def environ(self):
201201
@pytest.fixture
202202
def pip_runner(empty_env_osutils):
203203
pip = FakePip()
204-
pip_runner = PipRunner(pip, osutils=empty_env_osutils)
204+
pip_runner = PipRunner(python_exe=sys.executable,
205+
pip=pip,
206+
osutils=empty_env_osutils)
205207
return pip, pip_runner
206208

207209

@@ -871,15 +873,15 @@ def test_build_into_existing_dir_with_preinstalled_packages(
871873

872874
class TestSubprocessPip(object):
873875
def test_can_invoke_pip(self):
874-
pip = SubprocessPip()
876+
pip = SubprocessPip(python_exe=sys.executable)
875877
rc, out, err = pip.main(['--version'])
876878
# Simple assertion that we can execute pip and it gives us some output
877879
# and nothing on stderr.
878880
assert rc == 0
879881
assert err == b''
880882

881883
def test_does_error_code_propagate(self):
882-
pip = SubprocessPip()
884+
pip = SubprocessPip(python_exe=sys.executable)
883885
rc, _, err = pip.main(['badcommand'])
884886
assert rc != 0
885887
# Don't want to depend on a particular error message from pip since it

tests/unit/workflows/python_pip/test_actions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12

23
from unittest import TestCase
34
from mock import patch
@@ -15,7 +16,7 @@ def test_action_must_call_builder(self, PythonPipDependencyBuilderMock):
1516
builder_instance = PythonPipDependencyBuilderMock.return_value
1617

1718
action = PythonPipBuildAction("artifacts", "scratch_dir",
18-
"manifest", "runtime")
19+
"manifest", "runtime", sys.executable)
1920
action.execute()
2021

2122
builder_instance.build_dependencies.assert_called_with("artifacts",
@@ -28,7 +29,7 @@ def test_must_raise_exception_on_failure(self, PythonPipDependencyBuilderMock):
2829
builder_instance.build_dependencies.side_effect = PackagerError()
2930

3031
action = PythonPipBuildAction("artifacts", "scratch_dir",
31-
"manifest", "runtime")
32+
"manifest", "runtime", sys.executable)
3233

3334
with self.assertRaises(ActionFailedError):
3435
action.execute()

tests/unit/workflows/python_pip/test_packager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from collections import namedtuple
23

34
import mock
@@ -47,7 +48,9 @@ def calls(self):
4748
def pip_factory():
4849
def create_pip_runner(osutils=None):
4950
pip = FakePip()
50-
pip_runner = PipRunner(pip, osutils=osutils)
51+
pip_runner = PipRunner(python_exe=sys.executable,
52+
pip=pip,
53+
osutils=osutils)
5154
return pip, pip_runner
5255
return create_pip_runner
5356

0 commit comments

Comments
 (0)