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
This commit is contained in:
Reedip 2016-11-16 09:35:35 +05:30
parent 3a71621542
commit e94547d458

View File

@ -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