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:
parent
c0343207ea
commit
27ef627f1d
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user