Use universal_newlines with subprocess.check_output

Python 3 will complain when trying to split a byte-string using a string
so this change enables universal_newlines to make the split work in both
python 2 and 3. Also add a py3 tox environment.

Change-Id: I9af74b6c6cc9cfd0c973c85be04791aa6dc0acd4
This commit is contained in:
Corey O'Brien 2017-04-06 09:17:26 -04:00
parent 0762fcb0b5
commit cb171db770
2 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ def all_block_devices():
'''Run blkid and yield a BlockDevice for all devices.'''
try:
cmd = ['blkid', '-o', 'export']
out = subprocess.check_output(cmd)
out = subprocess.check_output(cmd, universal_newlines=True)
except Exception as e:
logger.error('Problem running "%s": %s', ' '.join(cmd), e)
else:

View File

@ -1,7 +1,7 @@
[tox]
minversion = 2.0
skipsdist = True
envlist = py27,pep8
envlist = py35,py27,pep8
[testenv]
usedevelop = True