コード例 #1
0
ファイル: test_deps_cli.py プロジェクト: nicoddemus/deps
def test_deps_parallel_2(cli_runner, project_tree, monkeypatch):
    """
    :type cli_runner: click.testing.CliRunner
    :type project_tree: py.path.local
    :type piped_shell_execute: mocker.patch
    """
    monkeypatch.chdir(project_tree.join('root_a'))
    command_args = ['--jobs=2', '--', 'python', '-c', '"name: {name}"']

    result = cli_runner.invoke(deps_cli.cli, command_args)
    assert result.exit_code == 0, result.output
    matcher = LineMatcher(result.output.splitlines())
    matcher.fnmatch_lines_random([
        '=======================================================================================================================',
        'dep_z (1/6)',
        'Finished: dep_z in *',
        '=======================================================================================================================',
        'dep_a.2, dep_a.1.1, dep_a.1.2 (4/6)',
        'Finished: dep_a.2 in *',
        'Finished: dep_a.1.1 in *',
        'Finished: dep_a.1.2 in *',
        '=======================================================================================================================',
        'dep_a.1 (5/6)',
        'Finished: dep_a.1 in *',
        '=======================================================================================================================',
        'root_a (6/6)',
        'Finished: root_a in *',
    ])
コード例 #2
0
def test_deps_parallel(cli_runner, project_tree, monkeypatch):
    """
    :type cli_runner: click.testing.CliRunner
    :type project_tree: py.path.local
    :type piped_shell_execute: mocker.patch
    """
    monkeypatch.chdir(project_tree.join("root_b"))
    command_args = ["--jobs=2", "--", "python", "-c", '"name: {name}"']

    result = cli_runner.invoke(deps_cli.cli, command_args)
    assert result.exit_code == 0, result.output
    matcher = LineMatcher(result.output.splitlines())
    matcher.fnmatch_lines_random([
        "=======================================================================================================================",
        "dep_z (1/4)",
        "Finished: dep_z in *",
        "=======================================================================================================================",
        "dep_b.1.1 (2/4)",
        "Finished: dep_b.1.1 in *",
        "=======================================================================================================================",
        "dep_b.1 (3/4)",
        "Finished: dep_b.1 in *",
        "=======================================================================================================================",
        "root_b (4/4)",
        "Finished: root_b in *",
    ])
コード例 #3
0
ファイル: test_deps_cli.py プロジェクト: nicoddemus/deps
def test_deps_parallel_unordered_error(cli_runner, project_tree, monkeypatch, piped_shell_execute):
    """
    :type cli_runner: click.testing.CliRunner
    :type project_tree: py.path.local
    :type piped_shell_execute: mocker.patch
    """
    task_script = os.path.join('tasks', 'does-not-exist')

    monkeypatch.chdir(project_tree.join('root_b'))
    command_args = ['-v', '--jobs=2', '--jobs-unordered', task_script]

    result = cli_runner.invoke(deps_cli.cli, command_args)
    assert result.exit_code != 0
    matcher = LineMatcher(result.output.splitlines())
    matcher.fnmatch_lines_random([
        'dep_z, dep_b.1.1, dep_b.1, root_b (4/4)',

        # We know that this will fail (it'll be the first). Others may fail or may be cancelled, we
        # can't guarantee.
        'deps: error: Command failed (project: dep_z)',
    ])
コード例 #4
0
def test_multiple_processes_logging_log_file(logging_master, matches):
    # And on the log file, we also have matches?
    matcher = LineMatcher(logging_master.log_file.read_text().splitlines())
    matcher.fnmatch_lines_random(matches)
コード例 #5
0
def test_multiple_processes_logging_stderr(logging_master, matches):
    # Are we seeing the main pid in the STDERR getting logged?
    # And there must be more than the main process in the STDERR logs
    matcher = LineMatcher(logging_master.ret.stderr.splitlines())
    matcher.fnmatch_lines_random(matches)