From e94547d4583ec1db21c4105ced7553b45e0b1d65 Mon Sep 17 00:00:00 2001 From: Reedip Date: Wed, 16 Nov 2016 09:35:35 +0530 Subject: [PATCH] Add is_bsd() to neutron-lib The is_bsd() testtool function is required for skipping some of the test cases in OSX/BSD environment. The is_bsd() check is useful when projects want to skip test cases related to IPv6 formatting as the implementation of netaddr differs in different platforms. Change-Id: I664e55883bbd714e31b49b278060e625fc5e6ea4 Related-Bug: #1484837 --- neutron_lib/tests/_tools.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/neutron_lib/tests/_tools.py b/neutron_lib/tests/_tools.py index 5e58d18bf..eb4ff0802 100644 --- a/neutron_lib/tests/_tools.py +++ b/neutron_lib/tests/_tools.py @@ -14,6 +14,7 @@ # under the License. import fixtures +import platform import warnings from neutron_lib.utils import helpers @@ -44,3 +45,14 @@ class WarningsFixture(fixtures.Fixture): for wtype in self.warning_types: warnings.filterwarnings( "always", category=wtype, module='^neutron_lib\\.') + + +def is_bsd(): + """Return True on BSD-based systems.""" + + system = platform.system() + if system == 'Darwin': + return True + if 'bsd' in system.lower(): + return True + return False