55
66from qbpm .main import main
77
8- no_desktop = "--no-desktop-file"
8+ from . import no_homedir_fixture # noqa: F401
9+
10+
11+ def run (* args : str ):
12+ return CliRunner ().invoke (main , args )
913
1014
1115def test_profile_dir_option (tmp_path : Path ):
1216 (tmp_path / "config.py" ).touch ()
13- runner = CliRunner ()
14- result = runner .invoke (
15- main , ["-P" , str (tmp_path ), "new" , "-C" , str (tmp_path ), no_desktop , "test" ]
16- )
17+ result = run ("-P" , str (tmp_path ), "new" , "-C" , str (tmp_path ), "test" )
1718 assert result .exit_code == 0
1819 assert result .output .strip () == str (tmp_path / "test" )
1920 assert tmp_path / "test" in list (tmp_path .iterdir ())
@@ -22,8 +23,7 @@ def test_profile_dir_option(tmp_path: Path):
2223def test_profile_dir_env (tmp_path : Path ):
2324 environ ["QBPM_PROFILE_DIR" ] = str (tmp_path )
2425 (tmp_path / "config.py" ).touch ()
25- runner = CliRunner ()
26- result = runner .invoke (main , ["new" , "-C" , str (tmp_path ), no_desktop , "test" ])
26+ result = run ("new" , "-C" , str (tmp_path ), "test" )
2727 assert result .exit_code == 0
2828 assert result .output .strip () == str (tmp_path / "test" )
2929 assert tmp_path / "test" in list (tmp_path .iterdir ())
@@ -33,8 +33,7 @@ def test_config_dir_option(tmp_path: Path):
3333 environ ["QBPM_PROFILE_DIR" ] = str (tmp_path )
3434 config = tmp_path / "config.py"
3535 config .touch ()
36- runner = CliRunner ()
37- result = runner .invoke (main , ["new" , "-C" , str (tmp_path ), no_desktop , "test" ])
36+ result = run ("new" , "-C" , str (tmp_path ), "test" )
3837 assert result .exit_code == 0
3938 assert str (config ) in (tmp_path / "test/config/config.py" ).read_text ()
4039
@@ -44,8 +43,7 @@ def test_relative_config_dir(tmp_path: Path):
4443 config = tmp_path / "config.py"
4544 config .touch ()
4645 chdir (tmp_path )
47- runner = CliRunner ()
48- result = runner .invoke (main , ["new" , "-C" , "." , no_desktop , "test" ])
46+ result = run ("new" , "-C" , "." , "test" )
4947 assert result .exit_code == 0
5048 assert str (config ) in (tmp_path / "test/config/config.py" ).read_text ()
5149
@@ -55,10 +53,7 @@ def test_from_session(tmp_path: Path):
5553 (tmp_path / "config.py" ).touch ()
5654 session = tmp_path / "test.yml"
5755 session .write_text ("windows:\n " )
58- runner = CliRunner ()
59- result = runner .invoke (
60- main , ["from-session" , "-C" , str (tmp_path ), no_desktop , str (session )]
61- )
56+ result = run ("from-session" , "-C" , str (tmp_path ), str (session ))
6257 assert result .exit_code == 0
6358 assert result .output .strip () == str (tmp_path / "test" )
6459 assert (tmp_path / "test/data/sessions/_autosave.yml" ).read_text () == ("windows:\n " )
0 commit comments