@@ -115,28 +115,40 @@ jobs:
115115 echo "=== Final check before tests ==="
116116 python << 'EOF'
117117 import re
118+ import os
118119
119120 # Check the source file directly (not the installed package)
120- with open('sentience/agent_runtime.py', 'r', encoding='utf-8') as f:
121+ file_path = 'sentience/agent_runtime.py'
122+ if not os.path.exists(file_path):
123+ print(f'ERROR: {file_path} not found!')
124+ exit(1)
125+
126+ with open(file_path, 'r', encoding='utf-8') as f:
121127 content = f.read()
128+ lines = content.split('\n')
122129
123130 # Check for the problematic pattern: self.assertTrue(
124131 # This is the bug we're checking for - it should be self.assert_( instead
125- if re.search(r'self\.assertTrue\s*\(', content):
132+ problematic_lines = []
133+ for i, line in enumerate(lines, 1):
134+ if re.search(r'self\.assertTrue\s*\(', line):
135+ problematic_lines.append((i, line.strip()))
136+
137+ if problematic_lines:
126138 print('ERROR: Found self.assertTrue( in agent_runtime.py')
127139 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()} ')
140+ print(f'\nFound {len(problematic_lines)} problematic line(s): ')
141+ for line_num, line_content in problematic_lines :
142+ print(f'Line {line_num}: {line_content}')
143+ print('\nTo fix: Replace self.assertTrue( with self.assert_( in the code above ')
132144 exit(1)
133145
134146 # Verify that self.assert_( is used (positive check)
135147 if 'self.assert_(' in content:
136148 print('OK: self.assert_ is used correctly (no self.assertTrue found)')
137149 else:
138150 print('WARNING: self.assert_( not found in agent_runtime.py')
139- print('This might indicate a different issue ')
151+ print('This might indicate the code needs to be updated ')
140152 EOF
141153
142154 - name : Run tests
0 commit comments