def test_other(monkeypatch): def mocked_remote_compute(x): print(f"other mocked received {x}") if x == 6: return 36 if x == 8: return 64 monkeypatch.setattr(mymath.externalapi, 'remote_compute', mocked_remote_compute) assert mymath.compute(6, 8) == 10 ...
def test_compute_breaks(): assert mymath.compute(3, 4) == 5
import mymath print(mymath.compute(3, 4))
def test_other(): res = mymath.compute(2, 7) ...
def test_compute(): assert mymath.compute(3, 4) == 5
def test_compute(monkeypatch): monkeypatch.setattr(mymath.externalapi, 'remote_compute', mocked_remote_compute) assert mymath.compute(3, 4) == 5 ...