Skip to content

Commit 607b3aa

Browse files
authored
Merge pull request #127 from tcdent/check-update-on-test
Disable update check in test environment
2 parents ff9c6ae + 927d86c commit 607b3aa

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

agentstack/update.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ def load_update_data():
6868

6969
def should_update() -> bool:
7070
"""Has it been longer than CHECK_EVERY since the last update check?"""
71+
# Allow disabling update checks with an environment variable
72+
if 'AGENTSTACK_UPDATE_DISABLE' in os.environ:
73+
return False
74+
7175
# Always check for updates in CI
7276
if _is_ci_environment():
7377
return True

tests/test_update.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import os
2+
import unittest
3+
from agentstack.update import should_update
4+
5+
6+
class UpdateTest(unittest.TestCase):
7+
def test_updates_disabled_by_env_var_in_test(self):
8+
assert 'AGENTSTACK_UPDATE_DISABLE' in os.environ
9+
assert not should_update()

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ commands =
1515
pytest -v {posargs}
1616
mypy: mypy agentops
1717
setenv =
18-
AGENTSTACK_TELEMETRY_OPT_OUT = 1
18+
AGENTSTACK_TELEMETRY_OPT_OUT = 1
19+
AGENTSTACK_UPDATE_DISABLE = 1

0 commit comments

Comments
 (0)