aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/mutation/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/servo/mutation/test.py')
-rw-r--r--python/servo/mutation/test.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/python/servo/mutation/test.py b/python/servo/mutation/test.py
index dd06871e65b..d3f4dd60ecb 100644
--- a/python/servo/mutation/test.py
+++ b/python/servo/mutation/test.py
@@ -14,11 +14,10 @@ import sys
def mutate_line(file_name, line_number):
- lines = open(file_name, 'r').readlines()
- lines[line_number - 1] = re.sub(r'\s&&\s', ' || ', lines[line_number - 1])
- out = open(file_name, 'w')
- out.writelines(lines)
- out.close()
+ for line in fileinput.input(file_name, inplace=True):
+ if(fileinput.lineno() == line_number):
+ line = re.sub(r'\s&&\s', ' || ', line)
+ print line.rstrip()
def mutation_test(file_name, tests):