@@ -75,6 +75,7 @@ def test_create_arg():
7575 if test_dir .exists ():
7676 shutil .rmtree (test_dir )
7777
78+ # Needs manual confirmation if we run with capture output on...
7879 with cli_args (['hutch_python' , '--create' , hutch ]):
7980 with restore_logging ():
8081 main ()
@@ -96,11 +97,9 @@ def run_hpy_and_exit(*args: str) -> subprocess.CompletedProcess:
9697
9798
9899@pytest .mark .timeout (30 )
99- def test_hist_file_arg (monkeypatch ):
100+ def test_hist_file_arg ():
100101 logger .debug ("test_hist_file_arg" )
101102 test_hist_file = (CFG_PATH .parent / "history.sqlite" ).resolve ()
102- bad_hist_file = (CFG_PATH .parent / "aesefiudh" / "history.sqlite" ).resolve ()
103- memory_hist_filename = ":memory:"
104103
105104 # Test that the sqlite file gets made
106105 # First, need to remove the file if it already exists
@@ -113,17 +112,27 @@ def test_hist_file_arg(monkeypatch):
113112 assert test_hist_file .exists ()
114113 # Remove the file for future tests
115114 test_hist_file .unlink ()
116- # With the bad hist file we should still run ok with just a warning
117- run_hpy_and_exit ("--hist-file" , str (bad_hist_file ))
118115 assert not test_hist_file .exists ()
119- # Same with the in-memory choice
120- run_hpy_and_exit ("--hist-file" , memory_hist_filename )
116+
117+
118+ @pytest .mark .timeout (30 )
119+ @pytest .mark .parametrize ("filepath," , (
120+ (CFG_PATH .parent / "aesefiudh" / "history.sqlite" ).resolve (),
121+ ":memory:" ,
122+ ))
123+ def test_no_hist_file (filepath ):
124+ # With the bad hist file or memory we should still run ok with just a warning
125+ test_hist_file = (CFG_PATH .parent / "history.sqlite" ).resolve ()
126+ run_hpy_and_exit ("--hist-file" , str (filepath ))
121127 assert not test_hist_file .exists ()
122128
129+
130+ @pytest .mark .timeout (30 )
131+ def test_template_file (monkeypatch ):
123132 # Exercise the template + check default usage
124133 # We can't actually write to the default default in a test context
125134 # But we can check what the config would be
126- new_default = str (test_hist_file .parent / "${USER}-history.sqlite" )
135+ new_default = str (CFG_PATH .parent / "${USER}-history.sqlite" )
127136 new_default_filled = Template (new_default ).substitute ({"USER" : os .environ ["USER" ]})
128137 monkeypatch .setattr (
129138 hutch_python .cli ,
0 commit comments