Python: Python 2 compatibility
Vicki Pfau vi@endrift.com
Sun, 13 Aug 2017 16:00:42 -0700
4 files changed,
7 insertions(+),
7 deletions(-)
M
src/platform/python/cinema/test.py
→
src/platform/python/cinema/test.py
@@ -21,7 +21,7 @@ self.settings = settings
try: with open(os.path.join(self.path, 'manifest.yml'), 'r') as f: dictMerge(self.settings, yaml.safe_load(f)) - except FileNotFoundError: + except IOError: pass self.tests = {}@@ -66,7 +66,7 @@ for i, frame in zip(itertools.count(), self.tracer.video(**self.outputSettings())):
try: baseline = VideoFrame.load(os.path.join(self.path, self.BASELINE % i)) yield baseline, frame, VideoFrame.diff(baseline, frame) - except FileNotFoundError: + except IOError: yield None, frame, (None, None) def test(self):@@ -83,7 +83,7 @@ for path, _, files in os.walk(root):
test = [f for f in files if re.match(CinemaTest.TEST, f)] if not test: continue - prefix = os.path.commonpath([path, root]) + prefix = os.path.commonprefix([path, root]) suffix = path[len(prefix)+1:] testPath = suffix.split(os.sep) testRoot = tests
M
src/platform/python/conftest.py
→
src/platform/python/conftest.py
@@ -42,7 +42,7 @@ if node.config.getoption("--mark-failing"):
try: with open(os.path.join(vtest.path, 'manifest.yml'), 'r') as f: settings = yaml.safe_load(f) - except FileNotFoundError: + except IOError: settings = {} settings['fail'] = True with open(os.path.join(vtest.path, 'manifest.yml'), 'w') as f:
M
src/platform/python/test_cinema.py
→
src/platform/python/test_cinema.py
@@ -40,7 +40,7 @@ vtest.generateBaseline()
else: try: vtest.test() - except FileNotFoundError: + except IOError: raise if pytestconfig.getoption('--mark-succeeding') and 'fail' in vtest.settings: # TODO: This can fail if an entire directory is marked as failing@@ -48,7 +48,7 @@ settings = {}
try: with open(os.path.join(vtest.path, 'manifest.yml'), 'r') as f: settings = yaml.safe_load(f) - except FileNotFoundError: + except IOError: pass if 'fail' in settings: del settings['fail']
M
src/platform/python/tests/cinema/gb/mooneye-gb/update.py
→
src/platform/python/tests/cinema/gb/mooneye-gb/update.py
@@ -41,7 +41,7 @@ manifest = {}
try: with open(os.path.join(dest, root, fname, 'manifest.yml'), 'r') as f: manifest = yaml.safe_load(f) or {} - except FileNotFoundError: + except IOError: pass dictMerge(manifest, { 'config': {