Improve testing in py3 environment
Change-Id: I1d169f0a87d4251778b32e80b3627b407340fec8
This commit is contained in:
parent
fa52a63e4f
commit
58de317f84
@ -181,7 +181,7 @@ def execute(*cmd, **kwargs):
|
||||
'specify a root helper.'))
|
||||
cmd = shlex.split(root_helper) + list(cmd)
|
||||
|
||||
cmd = map(str, cmd)
|
||||
cmd = [str(c) for c in cmd]
|
||||
sanitized_cmd = strutils.mask_password(' '.join(cmd))
|
||||
|
||||
while attempts > 0:
|
||||
|
@ -142,7 +142,7 @@ exit 1
|
||||
self.assertRaises(processutils.ProcessExecutionError,
|
||||
processutils.execute,
|
||||
tmpfilename, tmpfilename2, attempts=10,
|
||||
process_input='foo',
|
||||
process_input=b'foo',
|
||||
delay_on_retry=False)
|
||||
fp = open(tmpfilename2, 'r')
|
||||
runs = fp.read()
|
||||
@ -199,7 +199,7 @@ grep foo
|
||||
os.chmod(tmpfilename, 0o755)
|
||||
processutils.execute(tmpfilename,
|
||||
tmpfilename2,
|
||||
process_input='foo',
|
||||
process_input=b'foo',
|
||||
attempts=2)
|
||||
finally:
|
||||
os.unlink(tmpfilename)
|
||||
@ -295,7 +295,7 @@ grep foo
|
||||
|
||||
out, err = processutils.execute('/usr/bin/env', env_variables=env_vars)
|
||||
|
||||
self.assertIn('SUPER_UNIQUE_VAR=The answer is 42', out)
|
||||
self.assertIn(b'SUPER_UNIQUE_VAR=The answer is 42', out)
|
||||
|
||||
def test_exception_and_masking(self):
|
||||
tmpfilename = self.create_tempfiles(
|
||||
@ -314,8 +314,8 @@ grep foo
|
||||
'something')
|
||||
|
||||
self.assertEqual(38, err.exit_code)
|
||||
self.assertEqual(err.stdout, 'onstdout --password="***"\n')
|
||||
self.assertEqual(err.stderr, 'onstderr --password="***"\n')
|
||||
self.assertIn('onstdout --password="***"', err.stdout)
|
||||
self.assertIn('onstderr --password="***"', err.stderr)
|
||||
self.assertEqual(err.cmd, ' '.join([tmpfilename,
|
||||
'password="***"',
|
||||
'something']))
|
||||
|
4
tox.ini
4
tox.ini
@ -23,13 +23,13 @@ commands =
|
||||
deps = -r{toxinidir}/requirements-py3.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
lockutils-wrapper python -m testtools.run tests.unit.test_lockutils
|
||||
lockutils-wrapper python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:py34]
|
||||
deps = -r{toxinidir}/requirements-py3.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
lockutils-wrapper python -m testtools.run tests.unit.test_lockutils
|
||||
lockutils-wrapper python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
Loading…
Reference in New Issue
Block a user