potodo/tests/conftest.py

25 lines
538 B
Python
Raw Permalink Normal View History

2023-03-13 13:00:12 +00:00
from contextlib import suppress
2021-01-04 21:26:04 +00:00
from pathlib import Path
import pytest
from potodo.potodo import main
2021-01-04 21:26:04 +00:00
@pytest.fixture(name="repo_dir")
def _repo_dir():
2021-01-04 21:26:04 +00:00
return Path(__file__).resolve().parent / "fixtures" / "repository"
@pytest.fixture
def run_potodo(repo_dir, capsys, monkeypatch):
def run_it(argv):
monkeypatch.setattr(
"sys.argv", ["potodo", "--no-cache", "-p", str(repo_dir)] + argv
)
2023-03-13 13:00:12 +00:00
with suppress(SystemExit):
main()
return capsys.readouterr()
return run_it