def test_with_afni_system_check_with_dist_deprecated(data): platform.dist = MagicMock(side_effect=AttributeError( "module 'platform' has no attribute 'dist'")) platform.linux_distribution = MagicMock(side_effect=ValueError( "Non-specific error to force execution of except clause")) sinfo = SC.SysInfo() sinfo.show_general_sys_info()
def show_system_info_items(self, items=[]): '''Show a subset of items that would be in the full check_all, as displayed by show_system_info(). items is a list of strings, each being a keyword to display part of the full system check info. Keywords in this list can be built up over time. ''' self.sinfo = SC.SysInfo(verb=self.verb, data_root=self.data_root) # check for any known item strings for x in items: if x == 'num_cpu': print(self.sinfo.get_cpu_count()) if x == 'ver_matplotlib': print(self.sinfo.get_ver_matplotlib())
def test_with_afni_system_check_with_dist_deprecated(data, monkeypatch): with monkeypatch.context() as m: if hasattr(platform, "dist"): m.setattr( platform, "dist", MagicMock( side_effect=AttributeError("'platform' has no attribute 'dist'") ), ) if hasattr(platform, "linux_distribution"): m.setattr( platform, "linux_distribution", MagicMock( side_effect=ValueError( "Non-specific error to force execution of except clause" ) ), ) sinfo = SC.SysInfo() sinfo.show_general_sys_info()
def show_system_info(self): self.sinfo = SC.SysInfo(verb=self.verb, data_root=self.data_root) self.sinfo.show_all_sys_info()