Files
rfd/tests/integration/test_cli.py
Dave Gallant 12b12c5914 Run tests in GitHub Actions instead of Travis-CI (#89)
* Replace travis-ci with Actions

* Update README.md

* Add stdout to assertion failure
2021-05-01 13:07:55 -04:00

26 lines
564 B
Python

from subprocess import Popen, PIPE
import pytest
def run_cli(args):
cmd = ["python", "-m", "rfd"] + args.split()
p = Popen(cmd, stdout=PIPE)
stdout, _ = p.communicate()
assert p.returncode == 0, stdout
return stdout
def test_version():
stdout = run_cli("--version")
assert b"rfd v" in stdout
@pytest.mark.parametrize("args", ["", "--sort-by score"])
def test_threads(args):
run_cli("threads " + args)
@pytest.mark.parametrize("args", ["'pizza'", "'(coffee|starbucks)'"])
def test_search(args):
run_cli("search " + args)