Skip to content

Commit bcb85c8

Browse files
author
SentienceDEV
committed
fix tests
1 parent 31786e9 commit bcb85c8

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

.github/workflows/test.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,20 @@ jobs:
6666
if 'def assert_' in line:
6767
print(f'{i}:{line}', end='')
6868
69-
# Check for assertTrue (should NOT exist)
70-
print("\n=== Checking for assertTrue (should NOT exist) ===")
69+
# Check for problematic assertTrue patterns (should NOT exist)
70+
print("\n=== Checking for assertTrue patterns (should NOT exist) ===")
71+
import re
7172
with open('sentience/agent_runtime.py', 'r', encoding='utf-8') as f:
7273
content = f.read()
73-
if 'assertTrue' in content:
74-
print('ERROR: Found assertTrue - this should have been removed!')
74+
# Check for self.assertTrue( - this is the bug
75+
if re.search(r'self\.assertTrue\s*\(', content):
76+
print('ERROR: Found self.assertTrue( - should be self.assert_( instead!')
7577
exit(1)
76-
else:
77-
print('Good: no assertTrue found')
78+
# Check for assertTrue( without self. - unittest style (also wrong)
79+
if re.search(r'(?<!self\.)assertTrue\s*\(', content):
80+
print('ERROR: Found assertTrue( without self. - should use self.assert_( instead!')
81+
exit(1)
82+
print('Good: no problematic assertTrue patterns found')
7883
EOF
7984
8085
- name: Lint with pre-commit
@@ -108,7 +113,34 @@ jobs:
108113
shell: bash
109114
run: |
110115
echo "=== Final check before tests ==="
111-
python -c "from sentience.agent_runtime import AgentRuntime; import inspect; source = inspect.getsource(AgentRuntime.assert_done); print('assert_done source:'); print(source); exit(1) if 'assertTrue' in source else print('OK: assert_ is used correctly')"
116+
python << 'EOF'
117+
from sentience.agent_runtime import AgentRuntime
118+
import inspect
119+
120+
source = inspect.getsource(AgentRuntime.assert_done)
121+
print('assert_done source:')
122+
print(source)
123+
124+
# Check for problematic patterns: self.assertTrue( or assertTrue( without self.
125+
# But allow self.assertTrue as a method name if it exists
126+
import re
127+
128+
# Pattern 1: self.assertTrue( - this is the bug we're checking for
129+
if re.search(r'self\.assertTrue\s*\(', source):
130+
print('ERROR: Found self.assertTrue( - should be self.assert_( instead!')
131+
exit(1)
132+
133+
# Pattern 2: assertTrue( without self. - unittest style (also wrong)
134+
if re.search(r'(?<!self\.)assertTrue\s*\(', source):
135+
print('ERROR: Found assertTrue( without self. - should use self.assert_( instead!')
136+
exit(1)
137+
138+
# Pattern 3: Check that assert_ is used correctly
139+
if 'self.assert_(' in source:
140+
print('OK: self.assert_ is used correctly')
141+
else:
142+
print('WARNING: self.assert_( not found in assert_done')
143+
EOF
112144
113145
- name: Run tests
114146
run: |

0 commit comments

Comments
 (0)