diff --git a/Tests/helper.py b/Tests/helper.py index 1c9851e25..6dc117ebb 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -123,6 +123,21 @@ class PillowTestCase(unittest.TestCase): self.assertTrue(found) return result + def skipKnownBadTest(self, msg=None, platform=None, travis=None): + # Skip if platform/travis matches, and + # PILLOW_RUN_KNOWN_BAD is not true in the environment. + if bool(os.environ.get('PILLOW_RUN_KNOWN_BAD', False)): + print (os.environ.get('PILLOW_RUN_KNOWN_BAD', False)) + return + + skip = True + if platform is not None: + skip = sys.platform.startswith(platform) + if travis is not None: + skip = skip and (travis == bool(os.environ.get('TRAVIS',False))) + if skip: + self.skipTest(msg or "Known Bad Test") + def tempfile(self, template): assert template[:5] in ("temp.", "temp_") (fd, path) = tempfile.mkstemp(template[4:], template[:4])