qutebrowser profile manager

cli tests

+14 -3
+14 -3
tests/test_main.py
··· 1 1 from os import environ 2 2 from pathlib import Path 3 3 4 + from click.testing import CliRunner 5 + 4 6 from qbpm.main import main 5 7 6 8 7 9 def test_profile_dir_option(tmp_path: Path): 8 - main(["-P", str(tmp_path), "new", "test"]) 10 + runner = CliRunner() 11 + result = runner.invoke(main, ["-P", str(tmp_path), "new", "test"]) 12 + assert result.exit_code == 0 13 + assert result.output.strip() == str(tmp_path / "test") 9 14 assert list(tmp_path.iterdir()) == [tmp_path / "test"] 10 15 11 16 12 17 def test_profile_dir_env(tmp_path: Path): 13 18 environ["QBPM_PROFILE_DIR"] = str(tmp_path) 14 - main(["new", "test"]) 19 + runner = CliRunner() 20 + result = runner.invoke(main, ["new", "test"]) 21 + assert result.exit_code == 0 22 + assert result.output.strip() == str(tmp_path / "test") 15 23 assert list(tmp_path.iterdir()) == [tmp_path / "test"] 16 24 17 25 ··· 19 27 environ["QBPM_PROFILE_DIR"] = str(tmp_path) 20 28 session = tmp_path / "test.yml" 21 29 session.touch() 22 - main(["from-session", str(session)]) 30 + runner = CliRunner() 31 + result = runner.invoke(main, ["from-session", str(session)]) 32 + assert result.exit_code == 0 33 + assert result.output.strip() == str(tmp_path / "test") 23 34 assert set(tmp_path.iterdir()) == {session, tmp_path / "test"}