qubes: misc pylint fixes
This commit is contained in:
parent
bf4dbe07d5
commit
689dd64b0d
@ -29,7 +29,8 @@ import qubes.tools.qubes_create
|
||||
import qubes.tests
|
||||
|
||||
@qubes.tests.skipUnlessDom0
|
||||
class TC_00_qubes_create(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
|
||||
class TC_00_qubes_create(
|
||||
qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
|
||||
def test_000_basic(self):
|
||||
self.assertEqual(0, qubes.tools.qubes_create.main((
|
||||
'--qubesxml', qubes.tests.XMLPATH)))
|
||||
|
@ -132,9 +132,10 @@ class TC_00_qvm_run(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
|
||||
self.sharedopts + ['--filter-escape-chars', self.vm1.name,
|
||||
r'printf \\033']))
|
||||
|
||||
@unittest.skip('test not implemented')
|
||||
def test_007_gui(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def test_007_gui(self): # pylint: disable=no-self-use
|
||||
raise unittest.SkipTest('test not implemented')
|
||||
|
||||
|
||||
#parser.add_argument('--gui',
|
||||
#parser.add_argument('--no-gui', '--nogui',
|
||||
|
@ -116,7 +116,7 @@ class TC_90_QubesVM(qubes.tests.QubesTestCase):
|
||||
self.app = qubes.tests.vm.TestApp()
|
||||
|
||||
def test_000_init(self):
|
||||
vm = qubes.vm.qubesvm.QubesVM(self.app, None,
|
||||
qubes.vm.qubesvm.QubesVM(self.app, None,
|
||||
qid=1, name=qubes.tests.VMPREFIX + 'test')
|
||||
|
||||
def test_001_init_no_qid_or_name(self):
|
||||
@ -131,8 +131,8 @@ class TC_90_QubesVM(qubes.tests.QubesTestCase):
|
||||
class TestVM2(qubes.vm.qubesvm.QubesVM):
|
||||
event_fired = False
|
||||
@qubes.events.handler('domain-init')
|
||||
def on_domain_init(self, event):
|
||||
def on_domain_init(self, event): # pylint: disable=unused-argument
|
||||
self.__class__.event_fired = True
|
||||
|
||||
vm = TestVM2(self.app, None, qid=1, name=qubes.tests.VMPREFIX + 'test')
|
||||
TestVM2(self.app, None, qid=1, name=qubes.tests.VMPREFIX + 'test')
|
||||
self.assertTrue(TestVM2.event_fired)
|
||||
|
@ -29,6 +29,7 @@ import argparse
|
||||
import importlib
|
||||
import logging
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
import qubes.log
|
||||
|
||||
@ -107,7 +108,7 @@ class HelpPropertiesAction(argparse.Action):
|
||||
help=help)
|
||||
|
||||
# late import because of circular dependency
|
||||
import qubes
|
||||
import qubes # pylint: disable=redefined-outer-name
|
||||
self._klass = klass if klass is not None else qubes.Qubes
|
||||
|
||||
|
||||
|
@ -26,9 +26,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
import qubes
|
||||
import qubes.tools
|
||||
|
@ -26,9 +26,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
import qubes
|
||||
import qubes.tools
|
||||
|
@ -78,17 +78,6 @@ parser.add_argument('--no-filter-escape-chars',
|
||||
parser.add_argument('cmd', metavar='COMMAND',
|
||||
help='command to run')
|
||||
|
||||
#
|
||||
# parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
|
||||
# parser.add_option ("--tray", action="store_true", dest="tray", default=False,
|
||||
# help="Use tray notifications instead of stdout" )
|
||||
# parser.add_option ("--pause", action="store_true", dest="pause", default=False,
|
||||
# help="Do 'xl pause' for the VM(s) (can be combined this with --all)")
|
||||
# parser.add_option ("--unpause", action="store_true", dest="unpause", default=False,
|
||||
# help="Do 'xl unpause' for the VM(s) (can be combined this with --all)")
|
||||
# parser.add_option ("--nogui", action="store_false", dest="gui", default=True,
|
||||
# help="Run command without gui")
|
||||
##
|
||||
|
||||
def main(args=None):
|
||||
args = parser.parse_args(args)
|
||||
|
@ -664,9 +664,9 @@ class QubesVM(qubes.vm.BaseVM):
|
||||
['sudo', qubes.config.system_path['qubes_pciback_cmd'], pci])
|
||||
subprocess.check_call(
|
||||
['sudo', 'xl', 'pci-attach', str(self.xid), pci])
|
||||
except Exception as e:
|
||||
print >>sys.stderr, "Failed to attach PCI device on the fly " \
|
||||
"(%s), changes will be seen after VM restart" % str(e)
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.log.exception('Failed to attach PCI device {!r} on the fly,'
|
||||
' changes will be seen after VM restart.'.format(pci), e)
|
||||
|
||||
|
||||
@qubes.events.handler('device-pre-detached:pci')
|
||||
@ -690,9 +690,9 @@ class QubesVM(qubes.vm.BaseVM):
|
||||
user="root", input="00:%s" % vmdev)
|
||||
subprocess.check_call(
|
||||
['sudo', 'xl', 'pci-detach', str(self.xid), pci])
|
||||
except Exception as e:
|
||||
print >>sys.stderr, "Failed to detach PCI device on the fly " \
|
||||
"(%s), changes will be seen after VM restart" % str(e)
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.log.exception('Failed to detach PCI device {!r} on the fly,'
|
||||
' changes will be seen after VM restart.'.format(pci), e)
|
||||
|
||||
|
||||
#
|
||||
@ -936,7 +936,7 @@ class QubesVM(qubes.vm.BaseVM):
|
||||
|
||||
call_kwargs = {}
|
||||
if ignore_stderr or not passio:
|
||||
null = open("/dev/null", "rw")
|
||||
null = open("/dev/null", "r+")
|
||||
call_kwargs['stderr'] = null
|
||||
if not passio:
|
||||
call_kwargs['stdin'] = null
|
||||
|
Loading…
Reference in New Issue
Block a user