Ejemplo n.º 1
0
def test_create_project_with_auto_git(mock_completed_process_git):
    with mock.patch("subprocess.run") as mock_run:
        mock_run.return_value = mock_completed_process_git

        rubicon = Rubicon("memory", "test-root", auto_git_enabled=True)
        rubicon.create_project("Test Project A")

        expected = [
            mock.call(["git", "rev-parse", "--git-dir"], capture_output=True),
            mock.call(["git", "remote", "-v"], capture_output=True),
        ]

    assert mock_run.mock_calls == expected

    rubicon.repository.filesystem.store = {}
Ejemplo n.º 2
0
def test_create_experiment_with_auto_git():
    with mock.patch("subprocess.run") as mock_run:
        mock_run.return_value = MockCompletedProcess(stdout=b"test",
                                                     returncode=0)

        rubicon = Rubicon("memory", "test-root", auto_git_enabled=True)
        project = rubicon.create_project("Test Project A")
        project.log_experiment()

        expected = [
            mock.call(["git", "rev-parse", "--git-dir"], capture_output=True),
            mock.call(["git", "remote", "-v"], capture_output=True),
            mock.call(["git", "rev-parse", "--abbrev-ref", "HEAD"],
                      capture_output=True),
            mock.call(["git", "rev-parse", "HEAD"], capture_output=True),
        ]

    assert mock_run.mock_calls == expected

    rubicon.repository.filesystem.store = {}