How to use is_hot_pluggable method in avocado

Best Python code snippet using avocado_python

memory.py

Source:memory.py Github

copy

Full Screen

...59 """60 if glob.glob('/sys/devices/system/memory/memory*'):61 return True62 return False63def is_hot_pluggable(block):64 """65 Check if the given memory block is hotpluggable66 :param block: memory block id.67 :type string: like 198 or memory19868 :return: True if hotpluggable, else False69 :rtype: 'bool'70 """71 path = '/sys/devices/system/memory/%s/removable' % get_blk_string(block)72 return bool(int(genio.read_file(path)))73def hotplug(block):74 """75 Online the memory for the given block id.76 :param block: memory block id or or memory19877 :type string: like 198...

Full Screen

Full Screen

memhotplug.py

Source:memhotplug.py Github

copy

Full Screen

...48 mem_blocks = []49 for mem_blk in glob.glob(path):50 block = re.findall(r"\d+", os.path.basename(mem_blk))[0]51 block = re.sub(r'^\s*$', '', block)52 if memory.is_hot_pluggable(block):53 mem_blocks.append(block)54 def chunks(num):55 """56 Return number of blocks in chunks of 10057 """58 if num % 2:59 return num // 100 + 160 return num // 10061 count = chunks(len(mem_blocks) * ratio)62 return mem_blocks[:count]63def collect_dmesg(object):64 object.whiteboard = process.system_output("dmesg")65class MemStress(Test):66 '''...

Full Screen

Full Screen

plugin.py

Source:plugin.py Github

copy

Full Screen

1#! /usr/bin/env python2# -*- coding: utf-8 -*-3###############################################################################4## ##5## Copyright 2010-2012, Neil Wallace <neil@openmolar.com> ##6## ##7## This program is free software: you can redistribute it and/or modify ##8## it under the terms of the GNU General Public License as published by ##9## the Free Software Foundation, either version 3 of the License, or ##10## (at your option) any later version. ##11## ##12## This program is distributed in the hope that it will be useful, ##13## but WITHOUT ANY WARRANTY; without even the implied warranty of ##14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ##15## GNU General Public License for more details. ##16## ##17## You should have received a copy of the GNU General Public License ##18## along with this program. If not, see <http://www.gnu.org/licenses/>. ##19## ##20###############################################################################21import inspect22from PyQt4 import QtGui23class _PluginError(Exception):24 '''25 A custom exception26 '''27 def __init__(self, value="Unknown"):28 self.value = value29 def __str__(self):30 return repr(self.value)31class Plugin(object):32 '''33This class should be inherited by any class to be added to openmolar2.34Several key methods should be overwritten.35 '''36 #:37 SIMPLE = 038 #:39 FEE_SCALE = 140 #:41 IMPORTER = 242 #:43 TYPES = (0, 1, 2)44 #:45 name = "Unspecified"46 #:47 authors = "unknown"48 #:49 version = "None"50 #:51 is_signed = False52 #:53 is_active = False54 #: can this be installed without app restart?55 is_hot_pluggable = True56 #:57 unique_id = None58 #:59 TARGET = "client"60 PluginError = _PluginError61 def __init__(self, plugin_type=SIMPLE):62 '''63 Plugin.__init__(self, plugin_type=Plugin.UNKNOWN)64 registers the plugin with the application65 '''66 if not plugin_type in self.TYPES:67 raise self.PluginError("Unknown plugin_type")68 self._TYPE = plugin_type69 @property70 def file(self):71 return inspect.getfile(self.__class__)72 def setup_plugin(self):73 '''74 by default, this does nothing, if overwritten, this is your chance75 to add to the gui.76 note - the gui can be accessed by SETTINGS.main_ui77 see also tear_down78 '''79 pass80 def tear_down(self):81 '''82 deactive the plugin83 this should reverse the setup_plugin function84 '''85 pass86 @property87 def icon(self):88 '''89 An icon is presented to the preferences dialog.90 A default icon is provided, so overwriting is optional.91 '''92 return QtGui.QIcon(":icons/plugins.png")93 def about_dialog(self, parent=None):94 '''95 Plugin.about_dialog(self, parent=None)96 Displays a QMessageBox with parent "parent"97 providing some basic information when the user requests it.98 can be overwritten by the plugin if required99 '''100 message = _("Name") + u"\t : %s<br />"% self.name101 message += _("Authors") + u"\t : %s<br />"% self.authors102 message += _("Version") + u"\t : %s<hr />"% self.version103 message += _("Description") + u"\t : %s<hr />"% self.description104 message += "%s<hr />"% self.long_description105 message += _("Main File") + u"\t :<br />%s<hr />"% self.file106 message += _("Website") + u"\t : %s"% self.website107 QtGui.QMessageBox.information(parent,108 _("About") + " " + self.name, message)109 def config_dialog(self, parent=None):110 '''111 Plugin.config_dialog(self, parent=None)112 This method can be called by the user by pressing on a button in113 the preferences dialog.114 by default, Displays a QMessageBox with parent "parent" saying no config is possible.115 NB - I have not coded a way to make these settings persistant yet.116 '''117 message = u"%s %s"% (118 self.name, _("plugin has no configuration options"))119 QtGui.QMessageBox.information(parent,120 _("Configure") + " " + self.name, message)121 @property122 def description(self):123 '''124 (String) Plugin.description(self)125 this property should be overwritten by well behaved plugins126 which inherit from this class127 '''128 return "property description must be overwritten by subclasses"129 @property130 def long_description(self):131 '''132 (String) Plugin.long_description(self)133 this property should be overwritten by well behaved plugins134 which inherit from this class135 '''136 return "property long_description should be overwritten by subclasses"137 @property138 def website(self):139 '''140 (String) Plugin.website(self)141 a homepage for this plugin142 '''143 return "property website should be overwritten by subclasses"144 @property145 def TYPE(self):146 '''147 returns the value which determines the nature of this plugin148 '''149 return self._TYPE150 def get_estimate(self, patient):151 '''152 get_estimate called...153 this should be overwritten by fee scale plugins154 '''155 return self.get_estimate.__doc__156 def __cmp__(self, other):157 '''158 Plugin.__cmp__(self, other)159 makes a comparions based on attribute 'name'160 useful to get plugins listed in alphabetical order161 returns cmp(self.name, other.name)162 '''163 return cmp(self.name, other.name)164 def __repr__(self):165 message = ("PLUGIN: name '%s'\n"% self.name +166 " description '%s'\n"% self.description +167 " signed %s\n"% self.is_signed +168 " authors '%s'\n"% self.authors +169 " version '%s'\n"% self.version)170 return message171 def set_unique_id(self, id):172 self.unique_id = id173if __name__ == "__main__":174 import gettext175 gettext.install("")176 plug = Plugin()177 print plug178 app = QtGui.QApplication([])179 plug.about_dialog()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful