GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — GitPython/test/test_cli_process_counts.py at main · gitpython-developers/GitPython Expand file tree/ Copy pathtest_cli_process_counts.pyMore file actions 56 lines (44 loc) · 2.1 KB / Copy pathtest_cli_process_counts.pyFile metadata and controls56 lines (44 loc) · 2.1 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 """Count actual launches, including failures after spawn and persistent processes.""" import subprocess from types import SimpleNamespace import pytest from git import Git, _backend from git.exc import GitCommandError, GitCommandNotFound from test.lib.fixtures import read_only_fixture def process_count(): return _backend.statistics().get(("Git.execute", "CLI process"), 0) def test_process_count_tracks_success_failure_and_persistent_process(): git = Git(read_only_fixture("empty.sh", "sha1", "files") / "repo") before = process_count() git.version() assert process_count() == before + 1 with pytest.raises(GitCommandError): git.rev_parse("--verify", "HEAD") assert process_count() == before + 2 process = git.version(as_process=True) process.proc.communicate() process.wait() assert process_count() == before + 3 def test_process_count_ignores_missing_executable_and_external_launch(): tmp_path = read_only_fixture("empty.sh") before = process_count() with pytest.raises(GitCommandNotFound): Git(tmp_path).execute([str(tmp_path / "missing-git")]) assert process_count() == before subprocess.run([Git.GIT_PYTHON_GIT_EXECUTABLE, "version"], check=True, capture_output=True) assert process_count() == before @pytest.mark.parametrize("limit,failed", [(3, False), (4, False), (2, True)]) @pytest.mark.parametrize("option", ["--max-cli-processes", "--max-cli-test-processes"]) def test_pytest_cli_ceiling_sets_exit_status(monkeypatch, option, limit, failed): from test import conftest config = SimpleNamespace( getoption=lambda name: limit if name == option else None, _cli_process_start=2, _cli_process_phases={"call": 3}, ) session = SimpleNamespace(config=config, exitstatus=pytest.ExitCode.OK) with monkeypatch.context() as patch: patch.setattr(conftest, "cli_processes", lambda: 5) conftest.pytest_sessionfinish(session, pytest.ExitCode.OK) assert bool(config._cli_process_failures) is failed assert session.exitstatus == (pytest.ExitCode.TESTS_FAILED if failed else pytest.ExitCode.OK) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |