Exemple #1
0
 def __new__(cls, *args, **kwargs):
     new_cls = get_platform_subclass(Group)
     return super(cls, new_cls).__new__(new_cls)
Exemple #2
0
 def test_get_distribution_none(self):
     # match just the platform class, not a specific distribution
     with patch('assible.module_utils.common.sys_info.get_distribution',
                return_value=None):
         assert get_platform_subclass(self.LinuxTest) is self.Foo
Exemple #3
0
 def test_get_distribution_found(self):
     # match both the distribution and platform class
     with patch('assible.module_utils.common.sys_info.get_distribution',
                return_value="Bar"):
         assert get_platform_subclass(self.LinuxTest) is self.Bar
Exemple #4
0
 def test_not_linux(self):
     # if neither match, the fallback should be the top-level class
     with patch('platform.system', return_value="Foo"):
         with patch('assible.module_utils.common.sys_info.get_distribution',
                    return_value=None):
             assert get_platform_subclass(self.LinuxTest) is self.LinuxTest