~pvsr/qpm

qpm/tests/test_main.py -rw-r--r-- 656 bytes
8b6b26a0Peter Rice document dmenu-wl support 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from os import environ
from pathlib import Path

from qpm.main import main


def test_profile_dir_option(tmp_path: Path):
    main(["-P", str(tmp_path), "new", "test"])
    assert list(tmp_path.iterdir()) == [tmp_path / "test"]


def test_profile_dir_env(tmp_path: Path):
    environ["QPM_PROFILE_DIR"] = str(tmp_path)
    main(["new", "test"])
    assert list(tmp_path.iterdir()) == [tmp_path / "test"]


def test_from_session(tmp_path: Path):
    environ["QPM_PROFILE_DIR"] = str(tmp_path)
    session = tmp_path / "test.yml"
    session.touch()
    main(["from-session", str(session)])
    assert set(tmp_path.iterdir()) == {session, tmp_path / "test"}