@@ -117,45 +117,26 @@ jobs:
117117 import re
118118
119119 # Check the source file directly (not the installed package)
120- # This ensures we're checking what's actually in the repo
121120 with open('sentience/agent_runtime.py', 'r', encoding='utf-8') as f:
122121 content = f.read()
123122
124- # Find assert_done method - look for the method definition and its body
125- # Match from "def assert_done" until the next method/class at same indentation level
126- assert_done_pattern = r'def assert_done\([^)]*\):.*?(?=\n def |\nclass |\Z)'
127- assert_done_match = re.search(assert_done_pattern, content, re.DOTALL)
123+ # Check for the problematic pattern: self.assertTrue(
124+ # This is the bug we're checking for - it should be self.assert_( instead
125+ if re.search(r'self\.assertTrue\s*\(', content):
126+ print('ERROR: Found self.assertTrue( in agent_runtime.py')
127+ print('This should be self.assert_( instead!')
128+ print('\nSearching for the problematic line...')
129+ for i, line in enumerate(content.split('\n'), 1):
130+ if re.search(r'self\.assertTrue\s*\(', line):
131+ print(f'Line {i}: {line.strip()}')
132+ exit(1)
128133
129- if assert_done_match:
130- assert_done_source = assert_done_match.group(0)
131- print('assert_done method found')
132-
133- # Check for problematic patterns
134- # Pattern 1: self.assertTrue( - this is the bug we're checking for
135- if re.search(r'self\.assertTrue\s*\(', assert_done_source):
136- print('ERROR: Found self.assertTrue( - should be self.assert_( instead!')
137- print('\nassert_done source:')
138- print(assert_done_source)
139- exit(1)
140-
141- # Pattern 2: Check that assert_ is used correctly
142- if 'self.assert_(' in assert_done_source:
143- print('OK: self.assert_ is used correctly in assert_done')
144- else:
145- print('WARNING: self.assert_( not found in assert_done')
146- print('\nassert_done source:')
147- print(assert_done_source)
148- exit(1)
134+ # Verify that self.assert_( is used (positive check)
135+ if 'self.assert_(' in content:
136+ print('OK: self.assert_ is used correctly (no self.assertTrue found)')
149137 else:
150- # Fallback: check entire file for the problematic pattern
151- print('Could not isolate assert_done method, checking entire file...')
152- if re.search(r'self\.assertTrue\s*\(', content):
153- print('ERROR: Found self.assertTrue( in agent_runtime.py - should be self.assert_( instead!')
154- exit(1)
155- if 'self.assert_(' in content:
156- print('OK: self.assert_ is used in agent_runtime.py')
157- else:
158- print('WARNING: Could not verify assert_ usage')
138+ print('WARNING: self.assert_( not found in agent_runtime.py')
139+ print('This might indicate a different issue')
159140 EOF
160141
161142 - name : Run tests
0 commit comments