From 6108e14ad1ffe2fb780781bfe83a3b1bc9b99a32 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Feb 14 2017 23:38:04 +0000 Subject: Allow tests to indicate they don't support the current platform Merges: #255 Signed-off-by: Patrick Uiterwijk Reviewed-by: Rob Crittenden --- diff --git a/tests/helpers/common.py b/tests/helpers/common.py index 878fe12..97e7658 100755 --- a/tests/helpers/common.py +++ b/tests/helpers/common.py @@ -81,6 +81,15 @@ class IpsilonTestBase(object): self.testuser = pwd.getpwuid(os.getuid())[0] self.processes = [] + def platform_supported(self): + """This return whether the current platform supports this test. + + This is used for example with specific modules or features that are not + supported on all platforms due to dependency availability. + """ + # Every test defaults to being available on every platform + return True + def force_remove(self, op, name, info): os.chmod(name, 0700) os.remove(name) diff --git a/tests/tests.py b/tests/tests.py index f84059b..0d3afbc 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -87,6 +87,10 @@ if __name__ == '__main__': sys.exit(1) test = tests.plugins[args['test']] + if not test.platform_supported(): + print >> sys.stderr, "Test %s not supported on platform" % args['test'] + sys.exit(0) + if not os.path.exists(args['path']): os.makedirs(args['path'])