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
commit 4efec414e7
110 changed files with 1702 additions and 1547 deletions

View file

@ -56,6 +56,7 @@ def user():
return user
@pytest.fixture
def cfg_file():
data = '/ansible/test/cfg/path'
@ -79,12 +80,12 @@ def null_cfg_file():
def cwd():
data = '/ansible/test/cwd/'
old_cwd = os.getcwd
os.getcwd = lambda : data
os.getcwd = lambda: data
old_cwdu = None
if hasattr(os, 'getcwdu'):
old_cwdu = os.getcwdu
os.getcwdu = lambda : to_text(data)
os.getcwdu = lambda: to_text(data)
yield data
@ -199,7 +200,7 @@ class TestGetConfig:
assert constants.get_config(cfgparser, 'defaults', 'unknown', 'ANSIBLE_TEST_VAR', '~/local', value_type='path') == os.path.join(user['home'], 'local')
assert constants.get_config(cfgparser, 'defaults', 'unknown', 'ANSIBLE_TEST_VAR', 'local', value_type='path') == 'local'
assert constants.get_config(cfgparser, 'defaults', 'unknown', 'ANSIBLE_TEST_VAR', 'local', value_type='path', expand_relative_paths=True) \
== os.path.join(cfg_file, 'local')
== os.path.join(cfg_file, 'local')
# Need to implement tests for these
# def test_value_type_pathlist(self, cfgparser):
@ -213,6 +214,5 @@ class TestGetConfig:
# Need to test this
#def test_load_config_file():
# pass
# def test_load_config_file():
# pass