Skip to content

Commit

Permalink
Mock pexpect context management. Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aristizabal95 committed Jul 28, 2023
1 parent 3326768 commit 2a48d2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/medperf/tests/entities/test_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_cube_runs_command_with_extra_args(self, mocker, setup, task):
spy = mocker.patch("pexpect.spawn", side_effect=mpexpect.spawn)
expected_cmd = (
f"mlcube run --mlcube={self.manifest_path} --task={task} "
+ f'--platform={self.platform} test="test"'
+ f'--platform={self.platform} --network=none test="test"'
)

# Act
Expand Down
6 changes: 6 additions & 0 deletions cli/medperf/tests/mocks/pexpect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ class MockChild:
def __init__(self, exitstatus):
self.exitstatus = exitstatus

def __enter__(self):
pass

def __exit__(self):
self.close()

def isalive(self):
return False

Expand Down

0 comments on commit 2a48d2f

Please sign in to comment.