| monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x13b4b6900>
|
|
|
| def test_test_runner_runs_pytest_in_repo_dir_with_pythonpath(monkeypatch):
|
| """The UNIT gate runs ``python -m pytest -m unit`` (pytest's OWN exit code — reliable, not a bash
|
| wrapper's) with cwd=X and X prepended to PYTHONPATH, so pytest imports rtrader from the REBASED
|
| CANDIDATE, not the box's main-tree editable install."""
|
| seen = {}
|
|
|
| def _fake_run(args, **kw):
|
| seen["args"] = tuple(args)
|
| seen["cwd"] = kw.get("cwd")
|
| seen["pythonpath"] = (kw.get("env") or {}).get("PYTHONPATH", "")
|
| return _FakeProc(returncode=0, stdout="2761 passed")
|
|
|
| monkeypatch.setattr(CR.subprocess, "run", _fake_run)
|
| passed, _ = CR.default_test_runner("boxA", "feature/x", repo_dir="/tmp/robinhood-crucible")
|
| assert passed is True
|
| > assert seen["args"][1:3] == ("-m", "pytest") and "unit or e2e" in seen["args"] and "tests" in seen["args"]
|
| E AssertionError: assert (('-m', 'pytest') == ('-m', 'pytest')
|
| E
|
| E Full diff:
|
| E (
|
| E '-m',
|
| E 'pytest',
|
| E ) and 'unit or e2e' in ('/Users/cao/.pyenv/versions/3.12.12/bin/python', '-m', 'pytest', '-m', 'unit or e2e or functional', 'tests', ...))
|
|
|
| tests/services/test_crucible_runner.py:1237: AssertionError
|