<86>May 20 11:56:35 userdel[3308277]: delete user 'rooter' <86>May 20 11:56:35 userdel[3308277]: removed group 'rooter' owned by 'rooter' <86>May 20 11:56:35 userdel[3308277]: removed shadow group 'rooter' owned by 'rooter' <86>May 20 11:56:35 groupadd[3308282]: group added to /etc/group: name=rooter, GID=579 <86>May 20 11:56:35 groupadd[3308282]: group added to /etc/gshadow: name=rooter <86>May 20 11:56:35 groupadd[3308282]: new group: name=rooter, GID=579 <86>May 20 11:56:35 useradd[3308286]: new user: name=rooter, UID=579, GID=579, home=/root, shell=/bin/bash <86>May 20 11:56:35 userdel[3308294]: delete user 'builder' <86>May 20 11:56:35 userdel[3308294]: removed group 'builder' owned by 'builder' <86>May 20 11:56:35 userdel[3308294]: removed shadow group 'builder' owned by 'builder' <86>May 20 11:56:35 groupadd[3308302]: group added to /etc/group: name=builder, GID=580 <86>May 20 11:56:35 groupadd[3308302]: group added to /etc/gshadow: name=builder <86>May 20 11:56:35 groupadd[3308302]: new group: name=builder, GID=580 <86>May 20 11:56:35 useradd[3308309]: new user: name=builder, UID=580, GID=580, home=/usr/src, shell=/bin/bash <13>May 20 11:56:39 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>May 20 11:56:39 rpmi: libexpat-2.2.4-alt1 1503305345 installed <13>May 20 11:56:39 rpmi: libp11-kit-0.23.15-alt1 sisyphus+226408.100.2.1 1554288204 installed <13>May 20 11:56:39 rpmi: libtasn1-4.16.0-alt1 sisyphus+245480.100.1.1 1580825062 installed <13>May 20 11:56:39 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>May 20 11:56:39 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>May 20 11:56:39 rpmi: ca-certificates-2020.01.23-alt1 sisyphus+244791.300.2.1 1580285500 installed <13>May 20 11:56:39 rpmi: ca-trust-0.1.2-alt1 sisyphus+233348.100.1.1 1561653823 installed <13>May 20 11:56:39 rpmi: p11-kit-trust-0.23.15-alt1 sisyphus+226408.100.2.1 1554288204 installed <13>May 20 11:56:39 rpmi: libcrypto1.1-1.1.1g-alt1 sisyphus+249982.60.8.1 1587743711 installed <13>May 20 11:56:39 rpmi: libssl1.1-1.1.1g-alt1 sisyphus+249982.60.8.1 1587743711 installed <13>May 20 11:56:39 rpmi: python3-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>May 20 11:56:40 rpmi: python3-base-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>May 20 11:56:40 rpmi: libpython3-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>May 20 11:56:40 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>May 20 11:56:40 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>May 20 11:56:44 rpmi: libverto-0.3.0-alt1_7 sisyphus+225932.100.1.1 1553994919 installed <13>May 20 11:56:44 rpmi: libkeyutils-1.6-alt2 sisyphus+226520.100.2.1 1554512089 installed <13>May 20 11:56:44 rpmi: libcom_err-1.44.6-alt1 sisyphus+224154.100.1.1 1552091678 installed <86>May 20 11:56:44 groupadd[3318785]: group added to /etc/group: name=_keytab, GID=499 <86>May 20 11:56:44 groupadd[3318785]: group added to /etc/gshadow: name=_keytab <86>May 20 11:56:44 groupadd[3318785]: new group: name=_keytab, GID=499 <13>May 20 11:56:45 rpmi: libkrb5-1.17.1-alt1 sisyphus+242784.100.1.1 1576137330 installed <13>May 20 11:56:45 rpmi: libtirpc-1.2.6-alt1 sisyphus+250076.100.1.1 1587038270 installed <13>May 20 11:56:45 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed <13>May 20 11:56:45 rpmi: python-modules-encodings-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-compiler-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-email-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-unittest-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-nis-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-ctypes-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-multiprocessing-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-modules-logging-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>May 20 11:56:45 rpmi: python-tools-2to3-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed Building target platforms: i586 Building for target i586 Wrote: /usr/src/in/nosrpm/python3-module-infrae.testbrowser-2.0.2-alt3.nosrc.rpm <13>May 20 11:56:49 rpmi: python3-module-pkg_resources-1:46.1.3-alt1 sisyphus+250566.200.3.1 1587973342 installed <13>May 20 11:56:49 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>May 20 11:56:49 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>May 20 11:56:49 rpmi: python3-dev-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>May 20 11:56:49 rpmi: python3-module-setuptools-1:46.1.3-alt1 sisyphus+250566.200.3.1 1587973342 installed Installing python3-module-infrae.testbrowser-2.0.2-alt3.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.61685 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python3-module-infrae.testbrowser-2.0.2 + echo 'Source #0 (python3-module-infrae.testbrowser-2.0.2.tar):' Source #0 (python3-module-infrae.testbrowser-2.0.2.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python3-module-infrae.testbrowser-2.0.2.tar + cd python3-module-infrae.testbrowser-2.0.2 + /bin/chmod -c -Rf u+rwX,go-w . + echo 'Patch #0 (fix-incompatibility.patch):' Patch #0 (fix-incompatibility.patch): + /usr/bin/patch -p2 patching file src/infrae/testbrowser/browser.py patching file src/infrae/testbrowser/cookies.py patching file src/infrae/testbrowser/form.py patching file src/infrae/testbrowser/selenium/browser.py patching file src/infrae/testbrowser/selenium/cookies.py patching file src/infrae/testbrowser/selenium/form.py patching file src/infrae/testbrowser/wsgi.py + find ./ -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./src/infrae/testbrowser/wsgi.py RefactoringTool: Refactored ./src/infrae/testbrowser/form.py --- ./src/infrae/testbrowser/wsgi.py (original) +++ ./src/infrae/testbrowser/wsgi.py (refactored) @@ -2,7 +2,7 @@ # Copyright (c) 2010-2013 Infrae. All rights reserved. # See also LICENSE.txt -import urllib2 +import urllib.request, urllib.error, urllib.parse import io from zope.interface import implementer @@ -70,7 +70,7 @@ uri, query = uri.split('?', 1) if '#' in uri: uri, _ = uri.split('#', 1) - environ['PATH_INFO'] = urllib2.unquote(uri) + environ['PATH_INFO'] = urllib.parse.unquote(uri) environ['QUERY_STRING'] = query if data is not None and data_type is not None: environ['wsgi.input'].write(data) --- ./src/infrae/testbrowser/form.py (original) +++ ./src/infrae/testbrowser/form.py (refactored) @@ -23,7 +23,7 @@ key = getattr(control, name, 'missing') return (key.lower(), key, control) - super(ControlResultSet, self).__init__(map(prepare, controls)) + super(ControlResultSet, self).__init__(list(map(prepare, controls))) class ControlExpressions(object): @@ -40,13 +40,13 @@ expression = self.__expressions[name] def matcher(control): - for key, value in expression[0].items(): + for key, value in list(expression[0].items()): if getattr(control, key, None) != value: return False return True return ControlResultSet( - filter(matcher, self.__form.controls.values()), + list(filter(matcher, list(self.__form.controls.values()))), expression[1]) raise AttributeError(name) @@ -148,19 +148,19 @@ if self.__type in ['radio', 'checkbox', 'select']: for subvalue in value: assert subvalue in self.__options, \ - u"Invalid choice %s" % subvalue + "Invalid choice %s" % subvalue else: - assert len(value) == len(self.__value), u"Not enough values" + assert len(value) == len(self.__value), "Not enough values" else: if isinstance(value, int): value = str(value) - assert (isinstance(value, basestring) or + assert (isinstance(value, str) or isinstance(value, bool)), \ - u'Invalid value type %s set for control %r' % ( + 'Invalid value type %s set for control %r' % ( type(value).__name__, value) if self.__options: if value not in self.__options: - raise AssertionError(u"Invalid choice %s" % value) + raise AssertionError("Invalid choice %s" % value) self.__value = value return property(getter, setter) @@ -187,7 +187,7 @@ def getter(self): return self.__checked def setter(self, value): - assert self.checkable, u"Not checkable" + assert self.checkable, "Not checkable" self.__checked = bool(value) return property(getter, setter) @@ -198,7 +198,7 @@ if self.__type not in ['checkbox', 'radio']: # Support for multiple fields (hidden, other) assert element_type not in ['file', 'submit', 'select'], \ - u"%s: multiple input or mixing input %s and %s is not supported" % ( + "%s: multiple input or mixing input %s and %s is not supported" % ( element.name, self.__type, element_type) if self.__type != element_type: self.__type = 'mixed' @@ -220,7 +220,7 @@ return # Checkbox, radio assert self.__type == element_type, \ - u'%s: control extended with a different control type (%s with %s)' % ( + '%s: control extended with a different control type (%s wRefactoringTool: Refactored ./src/infrae/testbrowser/cookies.py RefactoringTool: Refactored ./src/infrae/testbrowser/browser.py ith %s)' % ( element.name, self.__type, element_type) if not self.options: # Firt time the control is extended @@ -243,7 +243,7 @@ self.__value.append(value) else: assert self.__value == '', \ - u'Not multiple control with multiple value' + 'Not multiple control with multiple value' self.__value = value self.__options.append(value) self.html.append(element) @@ -254,7 +254,7 @@ else: html = [self.html] return '\n'.join( - map(lambda h:lxml.etree.tostring(h, pretty_print=True), html)) + [lxml.etree.tostring(h, pretty_print=True) for h in html]) @implementer(IClickableFormControl) @@ -350,7 +350,7 @@ def get_control(self, name): if name not in self.controls: - raise AssertionError(u'No control %s' % name) + raise AssertionError('No control %s' % name) return self.controls.get(name) def submit(self, name=None, value=None): --- ./src/infrae/testbrowser/cookies.py (original) +++ ./src/infrae/testbrowser/cookies.py (refactored) @@ -88,7 +88,7 @@ self.cookies = {} def keys(self): - return self.cookies.keys() + return list(self.cookies.keys()) def __getitem__(self, key): return self.cookies[key] @@ -101,20 +101,20 @@ def __eq__(self, other): if isinstance(other, Cookies): - other = other.keys() - return self.keys() == other + other = list(other.keys()) + return list(self.keys()) == other def __ne__(self, other): if isinstance(other, Cookies): - other = other.keys() - return self.keys() != other + other = list(other.keys()) + return list(self.keys()) != other def get_request_headers(self): """Return the headers to use in the next request. """ if self.cookies: result = '' - for cookie in self.cookies.values(): + for cookie in list(self.cookies.values()): if result: result += "; " result += '%s=%s' % (cookie.name, cookie.value) @@ -122,7 +122,7 @@ return {} def __repr__(self): - cookies = '; '.join(map(repr, self.cookies.values())) + cookies = '; '.join(map(repr, list(self.cookies.values()))) if cookies: return cookies return '' --- ./src/infrae/testbrowser/browser.py (original) +++ ./src/infrae/testbrowser/browser.py (refactored) @@ -7,8 +7,8 @@ import lxml.etree import lxml.html import re -import urllib -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.parse from infrae.testbrowser.cookies import Cookies from infrae.testbrowser.expressions import Expressions, Link @@ -79,7 +79,7 @@ @property def location(self): if self.__url: - return urlparse.urlparse(self.__url).path + return urllib.parse.urlparse(self.__url).path return None @property @@ -100,7 +100,7 @@ try: return int(status.split(' ', 1)[0]) except ValueError: - raise AssertionError(u'Invalid HTTP status %s' % status) + raise AssertionError('Invalid HTTP status %s' % status) @property def headers(self): @@ -166,13 +166,13 @@ @property def history(self): - return map(lambda e: e[0], self.__history) + return [e[0] for e in self.__history] def _query_application(self, url, method, query, data, data_type): self.__cache = {} - info = urlparse.urlparse(url) - query_string = urllib.urlencode(query) if query else '' - uri = urlparse.urlunparse( + info = urllib.parse.urlparse(url) + query_string = urllib.parse.urlencode(query) if query else '' + uri = urllib.parse.urlunparse( (None, None, info.path, @@ -186,7 +186,7 @@ headers['Authorization'] = format_auth( info.username, info.password) self._process_response( - self.__server(method, uri, headers.items(), data, data_type)) + self.__server(method, uri, list(headers.items()), data, data_type)) def _process_response(self, response): self.__response = response @@ -204,7 +204,7 @@ self.__method = 'GET' location = self.headers.get('Location') assert location is not None, 'Redirect without location header' - location_url = urlparse.urlparse(location) + location_url = urllib.parse.urlparse(location) location_uri = None if location_url.netloc: # Inspect redirect URL @@ -221,10 +221,10 @@ # XXX Should include this information in history as well self.options.server = server self.options.port = port - location_uri = urlparse.urlunparse( + location_uri = urllib.parse.urlunparse( (None, None) + location_url[2:]) else: - location_uri = urlparse.urlunparse( + location_uri = urllib.parse.urlunparse( (None, None) + location_url[2:]) else: location_uri = location @@ -259,26 +259,26 @@ self.__method = method if form is not None: - assert not data, u'cannot have both form and data' - assert not data_type, u'cannot specify data_type when using form' + assert not data, 'cannot have both form and data' + assert not data_type, 'cannot specify data_type when using form' # We posted a form if method == 'GET': assert form_enctype == 'application/x-www-form-urlencoded', \ - u'Invalid form encoding for GET method' + 'Invalid form encoding for GET method' if query is not None: raise AssertionError( - u'Cannot handle a query with a GET form') + 'Cannot handle a query with a GET form') query = form else: - assert method == 'POST', u'Only support POST or GET forms' + assert method == 'POST', 'Only support POST or GET forms' if form_enctype == 'application/x-www-form-urlencoded': data_type = 'application/x-www-form-urlencoded' - data = urllib.urlencode(form) + data = urllib.parse.urlencode(form) elif form_enctype == 'multipart/form-data': data_type, data = encode_multipart_form_data(form, form_charset) else: raise AssertionError( - u"Unsupported form encoding %s" % form_enctype) + "Unsupported form encoding %s" % form_enctype) self.__data = data self.__data_type = data_type self._query_application(url, method, query, data, data_type) @@ -295,13 +295,13 @@ return self.status_code def get_form(self, name=None, id=None): - assert self.html is not None, u'Not viewing HTML' + assert self.html is not None, 'Not viewing HTML' expression = None if name is not None: expression = '//form[@name="%s"]' % name elif id is not None: expression = '//form[@id="%s"]' % id - assert expression is not None, u'Provides an id or a name to get_form' + assert expression is not None, 'Provides an id or a name to get_form' if expression not in self.__cache: nodes = self.html.xpath(expression) assert len(nodes) == 1, 'Form element not found' @@ -309,13 +309,13 @@ return self.__cache[expression] def get_link(self, content): - aRefactoringTool: Refactored ./src/infrae/testbrowser/utils.py ssert self.html is not None, u'Not viewing HTML' + assert self.html is not None, 'Not viewing HTML' urls = {} for link in self.html.xpath( '//a[contains(normalize-space(text()), "%s")]' % content): urls[link.attrib['href']] = link - assert len(urls) == 1, u'No link found' - return Link(urls.values()[0], self) + assert len(urls) == 1, 'No link found' + return Link(list(urls.values())[0], self) def close(self): if 'close' in self.handlers: --- ./src/infrae/testbrowser/utils.py (original) +++ ./src/infrae/testbrowser/utils.py (refactored) @@ -7,8 +7,9 @@ import mimetypes import operator import os -import urllib -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.parse +from functools import reduce _marker = object() @@ -33,40 +34,39 @@ return None return None - return filter(lambda c: c != None, - map(resolve_charset, + return [c for c in map(resolve_charset, reduce(operator.add, - map(lambda c: c.split(), charsets.split(','))))) + [c.split() for c in charsets.split(',')])) if c != None] def charset_encoder(charset, value): """Encoder a value in the given charset. """ - if isinstance(value, unicode): + if isinstance(value, str): return value.encode(charset, 'ignore') return str(value) def resolve_url(url, browser): """Resolve an absolute url given the current browser location. """ - parsed = urlparse.urlparse(urllib.unquote(url)) + parsed = urllib.parse.urlparse(urllib.parse.unquote(url)) if (parsed.scheme in ('', 'http', 'https') and not parsed.path.startswith('/')): # Be sure to always not have any relative links parsed = list(parsed) base = '/'.join(browser.location.split('/')[:-1]) parsed[2] = '/'.join((base, parsed[2])) - return urlparse.urlunparse(parsed) + return urllib.parse.urlunparse(parsed) def resolve_location(url): """Resolve a location out of an url. It does the opposite of resolve_url. """ - parsed = urlparse.urlparse(urllib.unquote(url)) + parsed = urllib.parse.urlparse(urllib.parse.unquote(url)) if parsed.netloc: parsed = list(parsed) parsed[1] = '' parsed[0] = '' - return urlparse.urlunparse(parsed) + return urllib.parse.urlunparse(parsed) def format_auth(user, password): return 'Basic ' + ':'.join((user, password)).encode('base64').strip() @@ -77,20 +77,20 @@ BOUNDARY = '------------uCtemt3iWu00F3QDhiwZ2nIQ$' data = [] if isinstance(fields, dict): - fields = fields.iteritems() + fields = iter(fields.items()) for key, value in fields: data.append('--' + BOUNDARY) - if isinstance(key, unicode): + if isinstance(key, str): key = key.encode(charset) if isinstance(value, File): data.append( 'Content-Disposition: form-data; name="%s"; filename="%s"' % ( - key, unicode(value.filename).encode(charset))) + key, str(value.filename).encode(charset))) data.append('Content-Type: %s' % value.content_type) else: data.append('Content-Disposition: form-data; name="%s"' % key) data.append('') - if isinstance(data, unicode): + if isinstance(data, str): data.append(value.encode(charset)) else: data.append(str(value)) @@ -156,13 +156,13 @@ self._values = values def keys(self): - return map(operator.itemgetter(1), self._values) + return list(map(operator.itemgetter(1), self._values)) def items(self): - return map(operator.itemgetter(1, 2), self._values) + return list(map(operator.itemgetter(1, 2), self._values)) def values(self): - return map(operator.itemgetter(2), self._values) + return lisRefactoringTool: No changes to ./src/infrae/testbrowser/tests/test_utils.py RefactoringTool: Refactored ./src/infrae/testbrowser/tests/test_headers.py t(map(operator.itemgetter(2), self._values)) iteritems = items iterkeys = keys @@ -170,16 +170,16 @@ def get(self, key, default=None, multiple=False): key = key.lower() - matches = filter(lambda item: key in item[0], self._values) + matches = [item for item in self._values if key in item[0]] if not matches: return default if len(matches) == 1: if multiple: return [matches[0][2]] return matches[0][2] - exact_matches = map( + exact_matches = list(map( operator.itemgetter(2), - filter(lambda item: key == item[0], matches)) + [item for item in matches if key == item[0]])) if multiple: return exact_matches if len(exact_matches) == 1: @@ -206,16 +206,16 @@ def __eq__(self, other): if isinstance(other, ResultSet): - other = other.keys() - return self.keys() == other + other = list(other.keys()) + return list(self.keys()) == other def __ne__(self, other): if isinstance(other, ResultSet): - other = other.keys() - return self.keys() != other + other = list(other.keys()) + return list(self.keys()) != other def __repr__(self): - return repr(map(operator.itemgetter(1), self._values)) + return repr(list(map(operator.itemgetter(1), self._values))) class Handlers(object): --- ./src/infrae/testbrowser/tests/test_headers.py (original) +++ ./src/infrae/testbrowser/tests/test_headers.py (refactored) @@ -14,17 +14,17 @@ headers = HTTPHeaders() headers['content-type'] = 'text/plain' - self.assertEquals(headers['content-type'], 'text/plain') - self.assertEquals(headers['Content-Type'], 'text/plain') + self.assertEqual(headers['content-type'], 'text/plain') + self.assertEqual(headers['Content-Type'], 'text/plain') headers['Content-Type'] = 'application/octet-stream' - self.assertEquals(headers['content-type'], 'application/octet-stream') - self.assertEquals(headers['Content-Type'], 'application/octet-stream') + self.assertEqual(headers['content-type'], 'application/octet-stream') + self.assertEqual(headers['Content-Type'], 'application/octet-stream') headers.update( - {'Content-Type': 'text/html', 'Content-Length': '42'}.items()) - self.assertEquals(headers['content-type'], 'text/html') - self.assertEquals(headers['content-length'], '42') + list({'Content-Type': 'text/html', 'Content-Length': '42'}.items())) + self.assertEqual(headers['content-type'], 'text/html') + self.assertEqual(headers['content-length'], '42') def test_non_existing_get(self): """Looking a non existing key raises KeyError. @@ -41,15 +41,15 @@ headers = HTTPHeaders() headers['Content-Length'] = '42' - self.assertEquals(headers.has_key('Content-Length'), True) - self.assertEquals(headers.has_key('content-length'), True) - self.failUnless('Content-Length' in headers) - self.failUnless('content-length' in headers) + self.assertEqual('Content-Length' in headers, True) + self.assertEqual('content-length' in headers, True) + self.assertTrue('Content-Length' in headers) + self.assertTrue('content-length' in headers) - self.assertEquals(headers.has_key('Server'), False) - self.assertEquals(headers.has_key('server'), False) - self.failIf('Server' in headers) - self.failIf('server' in headers) + self.assertEqual('Server' in headers, False) + self.assertEqual('server' in headers, False) + self.assertFalse('Server' in headers) + self.assertFalse('server' in headers) def test_items(self): """items return a list of tuples containing all headers. Header @@ -59,10 +59,10 @@ headers['content-type'] = 'text/plain' headers['Content-length'] = 42 RefactoringTool: No changes to ./src/infrae/testbrowser/tests/test_form.py RefactoringTool: Refactored ./src/infrae/testbrowser/tests/test_expressions.py WARNING: couldn't encode ./src/infrae/testbrowser/tests/test_expressions.py's diff for your terminal RefactoringTool: Refactored ./src/infrae/testbrowser/tests/test_browsing.py WARNING: couldn't encode ./src/infrae/testbrowser/tests/test_browsing.py's diff for your terminal RefactoringTool: Refactored ./src/infrae/testbrowser/tests/form.py RefactoringTool: Refactored ./src/infrae/testbrowser/tests/expressions.py WARNING: couldn't encode ./src/infrae/testbrowser/tests/expressions.py's diff for your terminal RefactoringTool: Refactored ./src/infrae/testbrowser/tests/browser.py - self.assertEquals( - headers.items(), + self.assertEqual( + list(headers.items()), [('Content-Length', '42'), ('Content-Type', 'text/plain')]) - self.assertEquals( - list(headers.iteritems()), + self.assertEqual( + list(headers.items()), [('Content-Length', '42'), ('Content-Type', 'text/plain')]) --- ./src/infrae/testbrowser/tests/test_expressions.py (original) +++ ./src/infrae/testbrowser/tests/test_expressions.py (refactored) @@ -29,7 +29,7 @@ browser.inspect.add('values', '//p') # we get a latin1 interpretation of utf-8 self.assertEqual(browser.inspect.values, --- ./src/infrae/testbrowser/tests/test_browsing.py (original) +++ ./src/infrae/testbrowser/tests/test_browsing.py (refactored) @@ -157,7 +157,7 @@ 'application/json') self.assertEqual(browser.html, None) self.assertEqual(browser.xml, None) - self.assertEqual(browser.json, [True, False, 1, u'a']) + self.assertEqual(browser.json, [True, False, 1, 'a']) def test_history(self): with Browser(app.test_app_iter) as browser: @@ -308,7 +308,7 @@ self.assertNotEqual(browser.html, None) self.assertEqual( browser.html.xpath('//li/text()'), --- ./src/infrae/testbrowser/tests/form.py (original) +++ ./src/infrae/testbrowser/tests/form.py (refactored) @@ -82,7 +82,7 @@ # Can only set string values self.assertRaises( AssertionError, setattr, password_field, 'value', ['something']) - password_field.value = u'secret' + password_field.value = 'secret' submit_field = form.get_control('save') self.assertNotEqual(submit_field, None) --- ./src/infrae/testbrowser/tests/expressions.py (original) +++ ./src/infrae/testbrowser/tests/expressions.py (refactored) @@ -74,27 +74,27 @@ ['Home', 'Contact', 'Contact Abroad', 'python']) self.assertEqual( browser.inspect.breadcrumbs, - [u'Home ...', - u'Development ...', - u'Advanced Lisp ...', --- ./src/infrae/testbrowser/tests/browser.py (original) +++ ./src/infrae/testbrowser/tests/browser.py (refactored) @@ -20,7 +20,7 @@ with self.Browser(app.test_app_cookies_server) as browser: self.assertTrue(verifyObject(ICookies, browser.cookies)) self.assertEqual(len(browser.cookies), 0) - self.assertEqual(browser.cookies.keys(), []) + self.assertEqual(list(browser.cookies.keys()), []) self.assertNotIn('browser', browser.cookies) self.assertEqual(repr(browser.cookies), '') browser.open('/page.html') @@ -49,11 +49,11 @@ """ with self.Browser(app.test_app_cookies_client) as browser: self.assertEqual(len(browser.cookies), 0) - self.assertEqual(browser.cookies.keys(), []) + self.assertEqual(list(browser.cookies.keys()), []) self.assertNotIn('food', browser.cookies) browser.open('/page.html') self.assertEqual(len(browser.cookies), 0) - self.assertEqual(browser.cookies.keys(), []) + self.assertEqual(list(browser.cookies.keys()), []) self.assertNotIn('food', browser.cookies) # No cookies are visible self.assertNotEqual(browser.html, None) @@ -84,7 +84,7 @@ # You can clear all cookies browser.cookies.clear() self.assertEqual(len(browser.cookies), 0) - self.assertEqual(browser.cookies.keys(), []) + self.assertEqual(list(browser.cookies.keys()), []) self.assertNotIn('food', browser.cookies) self.assertNotIn('drink', browser.cookies) browser.reload() @@ -110,6 +110,6 @@ browser.login('admin', 'admin') browser.logout() - self.assertEquaRefactoringTool: Refactored ./src/infrae/testbrowser/tests/app.py RefactoringTool: Refactored ./src/infrae/testbrowser/selenium/form.py ls( + self.assertEqual( called, [('login', 'admin', 'admin'), ('logout',), ('close',)]) --- ./src/infrae/testbrowser/tests/app.py (original) +++ ./src/infrae/testbrowser/tests/app.py (refactored) @@ -3,10 +3,10 @@ # See also LICENSE.txt import os -import urlparse +import urllib.parse def encode(value): - if isinstance(value, unicode): + if isinstance(value, str): return value.encode('utf-8') return str(value) @@ -35,9 +35,7 @@ def test_app_headers(environ, start_response): start_response('200 Ok', [('Content-type', 'text/html'),]) - headers = map(lambda k: '
  • %s:%s
  • ' % (k, environ[k]), - filter(lambda k: k.startswith('HTTP_'), - environ.keys())) + headers = ['
  • %s:%s
  • ' % (k, environ[k]) for k in [k for k in list(environ.keys()) if k.startswith('HTTP_')]] return [''] @@ -81,12 +79,12 @@ def test_app_cookies_server(environ, start_response): headers = [('Content-type', 'text/html')] - if 'HTTP_COOKIE' not in environ.keys(): + if 'HTTP_COOKIE' not in list(environ.keys()): # No cookies, set cookies ! headers.append(('Set-Cookie', 'browser=testing;Path=/')) start_response('200 Ok', headers) yield '