import re with open('addons/education_lms/tests/test_education_lms.py', 'r') as f: text = f.read() text = text.replace(" res = course_a.with_user(self.user_student_a).read(['name'])", " print(f'\\nDEBUG STUDENT IDS: {self.user_student_a.student_ids}')\n print(f'DEBUG STUDENT TERM: {self.user_student_a.student_ids.academic_term_id}')\n res = course_a.with_user(self.user_student_a).read(['name'])") with open('addons/education_lms/tests/test_education_lms.py', 'w') as f: f.write(text)