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

@ -10,8 +10,6 @@ except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("test_vmware_inventory.py requires the python module 'vmware_inventory'")
# contrib's dirstruct doesn't contain __init__.py files
checkout_path = os.path.dirname(__file__)
checkout_path = checkout_path.replace('/test/units/contrib/inventory', '')
@ -21,15 +19,19 @@ sys.path.append(os.path.abspath(inventory_dir))
# cleanup so that nose's path is not polluted with other inv scripts
sys.path.remove(os.path.abspath(inventory_dir))
BASICINVENTORY = {
'all': {
'hosts': ['foo', 'bar']
},
'_meta': {
'hostvars': {
'foo': {'hostname': 'foo'},
'bar': {'hostname': 'bar'}
}
}
}
BASICINVENTORY = {'all': {'hosts': ['foo', 'bar']},
'_meta': { 'hostvars': { 'foo': {'hostname': 'foo'},
'bar': {'hostname': 'bar'}}
}
}
class FakeArgs(object):
debug = False
write_dumpfile = None
@ -37,6 +39,7 @@ class FakeArgs(object):
host = False
list = True
class TestVMWareInventory(unittest.TestCase):
def test_host_info_returns_single_host(self):
@ -61,7 +64,7 @@ class TestVMWareInventory(unittest.TestCase):
except:
pass
assert serializable
#import epdb; epdb.st()
# import epdb; epdb.st()
def test_show_list_returns_serializable_data(self):
fakeargs = FakeArgs()
@ -78,7 +81,7 @@ class TestVMWareInventory(unittest.TestCase):
except:
pass
assert serializable
#import epdb; epdb.st()
# import epdb; epdb.st()
def test_show_list_returns_all_data(self):
fakeargs = FakeArgs()
@ -105,7 +108,7 @@ class TestVMWareInventory(unittest.TestCase):
except:
pass
assert serializable
#import epdb; epdb.st()
# import epdb; epdb.st()
def test_show_host_returns_just_host(self):
fakeargs = FakeArgs()
@ -117,5 +120,5 @@ class TestVMWareInventory(unittest.TestCase):
showdata = vmw.show()
expected = BASICINVENTORY['_meta']['hostvars']['foo']
expected = json.dumps(expected, indent=2)
#import epdb; epdb.st()
# import epdb; epdb.st()
assert showdata == expected