Skip to content

Commit 600b4aa

Browse files
committed
Add tests to ensure the mtime never changes when running via the CLI
1 parent 3b989e8 commit 600b4aa

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_integration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def test_cli(
176176

177177
result: Result
178178

179+
st = (tmp_pathplus / "code.py").stat()
180+
assert st == st
181+
179182
with in_directory(tmp_pathplus):
180183
runner = CliRunner(mix_stderr=False)
181184
result = runner.invoke(
@@ -189,13 +192,22 @@ def test_cli(
189192

190193
check_out(result, advanced_data_regression)
191194

195+
# mtime should have changed
196+
new_st = (tmp_pathplus / "code.py").stat()
197+
assert new_st.st_mtime != st.st_mtime
198+
assert new_st != st
199+
192200
# Calling a second time shouldn't change anything
193201
with in_directory(tmp_pathplus):
194202
runner = CliRunner(mix_stderr=False)
195203
result = runner.invoke(main, args=["code.py"])
196204

197205
assert result.exit_code == 0
198206

207+
# mtime should be the same
208+
assert (tmp_pathplus / "code.py").stat().st_mtime == new_st.st_mtime
209+
assert (tmp_pathplus / "code.py").stat() == new_st
210+
199211

200212
def test_cli_verbose_verbose(
201213
tmp_pathplus: PathPlus,

0 commit comments

Comments
 (0)