Skip to content

Commit 5bc13f4

Browse files
committed
Refactor test_install_jb to not assert time delta
1 parent ec1c82c commit 5bc13f4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_tools.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import stat
66
import sys
77

8-
from datetime import datetime, timedelta
8+
from datetime import datetime
99
from pathlib import Path
1010
from typing import Optional
1111
from unittest.mock import patch, MagicMock
@@ -276,6 +276,7 @@ def test_install_jb(config: Config, fs, capsys):
276276
config.managed_tools = {}
277277
_setup_tool_github_responses()
278278
assert not tools.MANAGED_TOOLS_PATH.exists()
279+
before_install = datetime.now()
279280

280281
tools.install_tool(config, "jb", None)
281282

@@ -299,7 +300,10 @@ def test_install_jb(config: Config, fs, capsys):
299300
assert len(state) == 1
300301
assert "jb" in state
301302
updated = datetime.fromisoformat(state["jb"])
302-
assert datetime.now() - updated < timedelta(seconds=1)
303+
# NOTE(sg): we're not checking timedelta here, instead we're verifying that the updated
304+
# timestamp is between now and before we installed the tool.
305+
assert datetime.now() > updated
306+
assert updated > before_install
303307

304308

305309
@pytest.mark.skipif(

0 commit comments

Comments
 (0)