mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-24 03:02:12 +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
|
from xml.etree import cElementTree as ET
|
||||||
EXPECTED_REQUESTS = []
|
EXPECTED_REQUESTS = []
|
||||||
|
|
||||||
if sys.version_info[0:2] in ((2, 6), (2, 7)):
|
|
||||||
bytes = lambda x, *args: x
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#python 2.x
|
#python 2.x
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
@ -111,7 +108,7 @@ class MyHTTPHandler(HTTPHandler):
|
|||||||
if 'text' not in kwargs and 'file' in kwargs:
|
if 'text' not in kwargs and 'file' in kwargs:
|
||||||
f = BytesIO(open(os.path.join(self.__fixtures_dir, kwargs['file']), 'rb').read())
|
f = BytesIO(open(os.path.join(self.__fixtures_dir, kwargs['file']), 'rb').read())
|
||||||
elif 'text' in kwargs and 'file' not in kwargs:
|
elif 'text' in kwargs and 'file' not in kwargs:
|
||||||
f = BytesIO(bytes(kwargs['text'], 'utf-8'))
|
f = BytesIO(kwargs['text'].encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
raise RuntimeError('either specify text or file')
|
raise RuntimeError('either specify text or file')
|
||||||
resp = addinfourl(f, {}, url)
|
resp = addinfourl(f, {}, url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user