bf911b2117
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
import sys
|
|
sys.path.insert(0, 'bin')
|
|
from stuck_check import is_stuck
|
|
|
|
def test_not_stuck_with_different_files():
|
|
entries = [
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['b.go']},
|
|
{'project': 'x', 'files_changed': ['c.go']},
|
|
]
|
|
assert is_stuck('x', entries) is False
|
|
|
|
def test_stuck_when_same_files_3_times():
|
|
entries = [
|
|
{'project': 'x', 'files_changed': ['a.go', 'b.go']},
|
|
{'project': 'x', 'files_changed': ['a.go', 'b.go']},
|
|
{'project': 'x', 'files_changed': ['a.go', 'b.go']},
|
|
]
|
|
assert is_stuck('x', entries) is True
|
|
|
|
def test_not_stuck_with_fewer_than_3_entries():
|
|
entries = [
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
]
|
|
assert is_stuck('x', entries) is False
|
|
|
|
def test_only_checks_matching_project():
|
|
entries = [
|
|
{'project': 'y', 'files_changed': ['a.go']},
|
|
{'project': 'y', 'files_changed': ['a.go']},
|
|
{'project': 'y', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
]
|
|
assert is_stuck('x', entries) is False # only 2 entries for x
|
|
|
|
def test_not_stuck_when_files_empty():
|
|
"""Empty file sets don't count as stuck — agent may not have changed anything."""
|
|
entries = [
|
|
{'project': 'x', 'files_changed': []},
|
|
{'project': 'x', 'files_changed': []},
|
|
{'project': 'x', 'files_changed': []},
|
|
]
|
|
assert is_stuck('x', entries) is False
|
|
|
|
def test_order_matters_only_last_3():
|
|
"""Only the last 3 entries matter."""
|
|
entries = [
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['a.go']},
|
|
{'project': 'x', 'files_changed': ['b.go']}, # most recent: different
|
|
]
|
|
assert is_stuck('x', entries) is False
|