1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-23 18:52:10 +01:00

Get rid of bytes usage in tests.common

Simply use the .encode() method (encode using the utf-8 encoding).
This commit is contained in:
Marcus Huewe 2020-06-03 17:49:51 +02:00
parent c0343207ea
commit 27ef627f1d

View File

@ -7,9 +7,6 @@ import sys
from xml.etree import cElementTree as ET
EXPECTED_REQUESTS = []
if sys.version_info[0:2] in ((2, 6), (2, 7)):
bytes = lambda x, *args: x
try:
#python 2.x
from cStringIO import StringIO
@ -111,7 +108,7 @@ class MyHTTPHandler(HTTPHandler):
if 'text' not in kwargs and 'file' in kwargs:
f = BytesIO(open(os.path.join(self.__fixtures_dir, kwargs['file']), 'rb').read())
elif 'text' in kwargs and 'file' not in kwargs:
f = BytesIO(bytes(kwargs['text'], 'utf-8'))
f = BytesIO(kwargs['text'].encode('utf-8'))
else:
raise RuntimeError('either specify text or file')
resp = addinfourl(f, {}, url)