Project fixes and cleanups (#5632)

This commit is contained in:
Stephanie Wang
2019-09-05 11:55:42 -07:00
committed by Philipp Moritz
parent 19bbf1eb4d
commit edcc56ea01
9 changed files with 102 additions and 64 deletions
+3 -30
View File
@@ -118,7 +118,9 @@ def test_session_start_default_project():
# Part 2/3: Rsync Calls
rsync_call = mock_calls["rsync"]
assert rsync_call.call_count == 1
# 1 for rsyncing the project directory, 1 for rsyncing the
# requirements.txt.
assert rsync_call.call_count == 2
_, kwargs = rsync_call.call_args
assert kwargs["source"] == loaded_project["environment"]["requirements"]
@@ -141,16 +143,6 @@ def test_session_start_default_project():
cmd for cmd in commands_executed if "pip install -r" not in cmd
]
# if we don't have a repo, we will be creating a directory
if "repo" not in loaded_project:
mkdir_command = "mkdir {project_name}".format(
project_name=loaded_project["name"])
assert any(mkdir_command in cmd for cmd in commands_executed)
# pop the `pip install` off commands executed
commands_executed = [
cmd for cmd in commands_executed if mkdir_command not in cmd
]
assert expected_commands == commands_executed
@@ -163,25 +155,6 @@ def test_session_start_docker_fail():
"not implemented") in result.output
def test_session_git_repo_cloned():
result, mock_calls, test_dir = run_test_project(
"session-tests/git-repo-pass", start, [])
loaded_project = ray.projects.load_project(test_dir)
assert result.exit_code == 0
exec_cluster_call = mock_calls["exec_cluster"]
commands_executed = []
for _, kwargs in exec_cluster_call.call_args_list:
command_executed = kwargs["cmd"]
# Filter out the cd call that was appended to each command
cd_project_dir_call = "cd {}; ".format(loaded_project["name"])
command_executed = command_executed.replace(cd_project_dir_call, "")
commands_executed.append(command_executed)
assert any("git clone" in cmd for cmd in commands_executed)
def test_session_invalid_config_errored():
result, _, _ = run_test_project("session-tests/invalid-config-fail", start,
[])