import sys with open('addons/education_lms/tests/test_education_lms.py', 'r') as f: text = f.read() text = text.replace( """ print(f"\\nDEBUG COURSE: p={course_a.program_id.id}, y={course_a.academic_year_id.id}, t={course_a.term_id.id}, b={course_a.batch_id.id}")""", """ print(f"\\nDEBUG COURSE_A: p={course_a.program_id.id}, y={course_a.academic_year_id.id}, t={course_a.term_id.id}, b={course_a.batch_id.id}, state={course_a.state}") print(f"DEBUG COURSE_FACULTY_A: p={self.course_faculty_a.program_id.id}, y={self.course_faculty_a.academic_year_id.id}, t={self.course_faculty_a.term_id.id}, b={self.course_faculty_a.batch_id.id}, state={self.course_faculty_a.state}") """ ) with open('addons/education_lms/tests/test_education_lms.py', 'w') as f: f.write(text)