virt-manager/tests
Radostin Stoyanov 81d68e6100 Use StringIO instad of BytesIO in Py 3
The print function in Python will convert printed arguments to text
strings [1] and thus print() cannot be used with binary mode file
objects.

In Python 2 the write() method of BytesIO() takes as input *bytes* object
which refers to *str* in Python 3. [2] The write() method of StringIO()
takes *unicode* object. [3] Therefore, StringIO() object cannot be used with
the print() function.

In Python 3 the write() method of BytesIO() takes a *bytes* object (not
*str*). [4] Therefore, the BytesIO() obj cannot be used with print().
However, the write() method of StringIO() in Python 3 takes a *str* as
input.[5]

Example of the issue:

    from __future__ import print_function
    import io

    a = io.BytesIO()
    b = io.StringIO()

    print("test", file=a)  <- Fails for Python 3
    print("test", file=b)  <- Fails for Python 2

    a.write('%s\n' % "test")  <- Fails for Python 3
    b.write('%s\n' % "test")  <- Fails for Python 2

[1] https://docs.python.org/3.5/library/functions.html#print
[2] https://docs.python.org/2/library/io.html#io.BufferedWriter.write
[3] https://docs.python.org/2/library/io.html#io.TextIOBase.write
[4] https://docs.python.org/3/library/io.html#io.BufferedWriter.write
[5] https://docs.python.org/3/library/io.html#io.TextIOBase.write
2018-02-06 18:49:17 -05:00
..
capabilities-xml capabilities: Drop cpu_map.xml handling 2017-07-17 11:47:01 -04:00
cli-test-xml virtinst: add vcpupin support 2018-02-06 10:21:56 -05:00
clone-xml cloner: get original XML with security informations 2017-09-18 09:04:35 +02:00
hostkeymap tests: Add more hostkeymap tests 2017-10-18 18:42:50 -04:00
inject-data tests: Add test_initrd_inject command 2013-09-28 16:50:08 -04:00
interface-xml Use XMLBuilder for Interface XML 2013-09-19 16:56:38 -04:00
nodedev-xml/devxml hostdev: add an address element for USB host devs if necessary 2015-08-05 13:32:04 +02:00
storage-xml tests: Remove storage UUID hackery 2017-12-14 12:45:01 -05:00
uitests uitests: Add a test for command line errors 2018-01-21 14:42:44 -05:00
virtconv-files virtconv: Don't implicitly depend on dict hash order 2017-10-20 16:13:04 -04:00
xmlconfig-xml tests: Fix after vmvga change 2017-04-19 14:08:04 -04:00
xmlparse-xml tests: Remove storage UUID hackery 2017-12-14 12:45:01 -05:00
__init__.py tests: test_urls: Big rework 2018-01-06 14:04:34 -05:00
capabilities.py capabilities: Fix model list caching for different archs (bz 1451113) 2017-07-17 11:47:01 -04:00
checkprops.py tests: Stop using deprecated assertEquals 2017-05-05 12:40:52 -04:00
clitest.py Use StringIO instad of BytesIO in Py 3 2018-02-06 18:49:17 -05:00
clonetest.py cloner: get original XML with security informations 2017-09-18 09:04:35 +02:00
hostkeymap.py pylint: Replace deprecated assertEquals with assertEqual 2017-10-22 19:24:29 +08:00
interface.py pycodestyle: Do not use bare 'except:' 2017-08-02 13:57:43 -04:00
magicuri tests: Add 'magicuri' helper 2018-01-21 15:08:16 -05:00
misc.py tests: Add msgfmt validation for pofiles 2017-03-21 19:23:29 -04:00
nodedev.py Wrap keys(), values() in a list 2018-02-06 18:49:17 -05:00
osdict.py tests: Split out osdict and uriparse from misc.py 2015-04-04 14:43:12 -04:00
pycodestyle.cfg pycodestyle: fix all E125 warnings 2017-10-21 23:26:16 +08:00
pylint.cfg tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -04:00
storage.py tests: Remove storage UUID hackery 2017-12-14 12:45:01 -05:00
test_inject.py tests: inject: Fix some pylint 2018-01-27 16:27:41 -05:00
test_urls.ini tests: test_urls: Big rework 2018-01-06 14:04:34 -05:00
test_urls.py Wrap keys(), values() in a list 2018-02-06 18:49:17 -05:00
testdriver.xml devicedisk: copy all rbd pool host and auth for volume 2018-01-30 11:30:22 -05:00
uriparse.py connect: Handle \ in username 2017-06-01 14:26:46 -04:00
utils.py uitests: Wire up --coverage 2018-01-09 13:51:53 -05:00
virtconvtest.py Use StringIO instad of BytesIO in Py 3 2018-02-06 18:49:17 -05:00
xmlconfig.py guest: Don't add default ps2 or xen mouse 2017-06-28 16:17:50 -04:00
xmlparse.py tests: xmlparse: explain AddRemoveDevice cases 2017-10-26 12:02:03 +02:00