Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: testing/tools/suppressor.py

Issue 1057983003: Refactor PDFium python test utilities. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix imports in one more file. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/tools/run_pixel_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The PDFium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7
8 import common
9
10 class Suppressor:
11 SUPPRESSIONS_FILENAME = 'SUPPRESSIONS'
12 PLATFORM_SUPPRESSIONS_FILENAME = 'SUPPRESSIONS_%s' % common.os_name()
13
14 def __init__(self, finder):
15 testing_dir = finder.TestingDir()
16 self.suppression_list = self._ExtractSuppressions(
17 os.path.join(testing_dir, self.SUPPRESSIONS_FILENAME))
18 self.platform_suppression_list = self._ExtractSuppressions(
19 os.path.join(testing_dir, self.PLATFORM_SUPPRESSIONS_FILENAME))
20
21 def _ExtractSuppressions(self, suppressions_filename):
22 with open(suppressions_filename) as f:
23 return [y for y in [x.split('#')[0].strip() for x in f.readlines()] if y]
24
25 def IsSuppressed(self, input_filename):
26 if input_filename in self.suppression_list:
27 print ("Not running %s, found in %s file" %
28 (input_filename, self.SUPPRESSIONS_FILENAME))
29 return True
30 if input_filename in self.platform_suppression_list:
31 print ("Not running %s, found in %s file" %
32 (input_filename, self.PLATFORM_SUPPRESSIONS_FILENAME))
33 return True
34 return False
OLDNEW
« no previous file with comments | « testing/tools/run_pixel_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698