import re with open('addons/education_lms/tests/test_education_lms.py', 'r') as f: text = f.read() text = re.sub(r' # Debug Domain\n.*?\n.*?\n.*?\n', '', text, flags=re.DOTALL) with open('addons/education_lms/tests/test_education_lms.py', 'w') as f: f.write(text)