test/: PEP8 compliancy (#24803)

* test/: PEP8 compliancy

- Make PEP8 compliant

* Python3 chokes on casting int to bytes (#24952)

But if we tell the formatter that the var is a number, it works
This commit is contained in:
Dag Wieers 2017-05-30 19:05:19 +02:00 committed by John R Barker
parent 31c59ad5f9
commit 4efec414e7
110 changed files with 1702 additions and 1547 deletions

View file

@ -51,7 +51,7 @@ class TestAnsibleModuleSysLogSmokeTest(unittest.TestCase):
ansible.module_utils.basic._ANSIBLE_ARGS = None
self.am = ansible.module_utils.basic.AnsibleModule(
argument_spec = dict(),
argument_spec=dict(),
)
self.am._name = 'unittest'
@ -89,7 +89,7 @@ class TestAnsibleModuleJournaldSmokeTest(unittest.TestCase):
ansible.module_utils.basic._ANSIBLE_ARGS = None
self.am = ansible.module_utils.basic.AnsibleModule(
argument_spec = dict(),
argument_spec=dict(),
)
self.am._name = 'unittest'
@ -120,7 +120,7 @@ class TestAnsibleModuleLogSyslog(unittest.TestCase):
b'Byte string': b'Byte string',
u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test'.encode('utf-8'),
b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace').encode('utf-8'),
}
}
py3_output_data = {
u'Text string': u'Text string',
@ -128,7 +128,7 @@ class TestAnsibleModuleLogSyslog(unittest.TestCase):
b'Byte string': u'Byte string',
u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test',
b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace')
}
}
def setUp(self):
args = json.dumps(dict(ANSIBLE_MODULE_ARGS={}))
@ -138,7 +138,7 @@ class TestAnsibleModuleLogSyslog(unittest.TestCase):
ansible.module_utils.basic._ANSIBLE_ARGS = None
self.am = ansible.module_utils.basic.AnsibleModule(
argument_spec = dict(),
argument_spec=dict(),
)
self.am._name = 'unittest'
@ -189,7 +189,7 @@ class TestAnsibleModuleLogJournal(unittest.TestCase):
b'Byte string': u'Byte string',
u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test',
b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace')
}
}
# overriding run lets us use context managers for setup/teardown-esque behavior
def setUp(self):
@ -200,7 +200,7 @@ class TestAnsibleModuleLogJournal(unittest.TestCase):
ansible.module_utils.basic._ANSIBLE_ARGS = None
self.am = ansible.module_utils.basic.AnsibleModule(
argument_spec = dict(),
argument_spec=dict(),
)
self.am._name = 'unittest'
@ -270,4 +270,3 @@ class TestAnsibleModuleLogJournal(unittest.TestCase):
# We added this journal field
self.assertIn('TEST', mock_func.call_args[1])
self.assertIn('log unittest', mock_func.call_args[1]['TEST'])