mirror of https://github.com/mgba-emu/mgba.git
Python: Python 2 compatibility
This commit is contained in:
parent
04713d9de1
commit
d68e12c354
|
@ -21,7 +21,7 @@ class CinemaTest(object):
|
|||
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 @@ class VideoTest(CinemaTest):
|
|||
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 @@ def gatherTests(root=os.getcwd()):
|
|||
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
|
||||
|
|
|
@ -42,7 +42,7 @@ def pytest_exception_interact(node, call, report):
|
|||
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:
|
||||
|
|
|
@ -40,7 +40,7 @@ def test_video(vtest, pytestconfig):
|
|||
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 @@ def test_video(vtest, pytestconfig):
|
|||
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']
|
||||
|
|
|
@ -41,7 +41,7 @@ def ingestDirectory(path, dest):
|
|||
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': {
|
||||
|
|
Loading…
Reference in New Issue