Skip to content

Commit b9e27fb

Browse files
committed
Mock return value of run_command.
1 parent 372f7af commit b9e27fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/unitary/with_extras/opctl/test_opctl_conda.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
55

66
import pytest
7-
from mock import patch, MagicMock
7+
from unittest.mock import patch, MagicMock, PropertyMock
88
import tempfile
99
import os
1010
from pathlib import Path
@@ -24,6 +24,8 @@ class TestOpctlConda:
2424
def test_conda_create(
2525
self, mock_run_container, mock_docker, mock_run_cmd, monkeypatch
2626
):
27+
type(mock_run_cmd.return_value).returncode = PropertyMock(return_value=0)
28+
mock_run_cmd.returncode = 0
2729
with pytest.raises(FileNotFoundError):
2830
create(slug="test Abc", environment_file="environment.yaml")
2931
with tempfile.TemporaryDirectory() as td:
@@ -101,6 +103,7 @@ def test_conda_publish(
101103
mock_run_cmd,
102104
monkeypatch,
103105
):
106+
type(mock_run_cmd.return_value).returncode = PropertyMock(return_value=0)
104107
with tempfile.TemporaryDirectory() as td:
105108
with pytest.raises(FileNotFoundError):
106109
publish(

0 commit comments

Comments
 (0)