diff --git a/client/doc/tutorial_test_1.py b/client/doc/tutorial_test_1.py index 8597866..aeffa93 100644 --- a/client/doc/tutorial_test_1.py +++ b/client/doc/tutorial_test_1.py @@ -7,6 +7,8 @@ one test method. """ +from __future__ import print_function, division, absolute_import, unicode_literals + from funq.testcase import FunqTestCase import time diff --git a/client/doc/tutorial_test_widgets.py b/client/doc/tutorial_test_widgets.py index c3b8177..ec6c3c4 100644 --- a/client/doc/tutorial_test_widgets.py +++ b/client/doc/tutorial_test_widgets.py @@ -6,8 +6,9 @@ interaction. """ +from __future__ import print_function, division, absolute_import, unicode_literals + from funq.testcase import FunqTestCase -from funq.client import FunqError class TestCase2(FunqTestCase): @@ -22,7 +23,7 @@ def test_libelle_btn_test(self): btn_test = self.funq.widget('btnTest') properties = btn_test.properties() - self.assertEquals(properties['text'], 'Test') + self.assertEqual(properties['text'], 'Test') def test_open_dialog(self): """ @@ -31,7 +32,7 @@ def test_open_dialog(self): self.funq.widget('btnTest').click() dlg_label = self.funq.widget('dialog1_label') - self.assertEquals(dlg_label.properties()['text'], "Button clicked") + self.assertEqual(dlg_label.properties()['text'], "Button clicked") def test_tableview_content(self): """ @@ -39,12 +40,12 @@ def test_tableview_content(self): """ view = self.funq.widget('tableview') items = list(view.model_items().iter()) - self.assertEquals(len(items), 16) + self.assertEqual(len(items), 16) for item in items: text = "row {r}, column {c}".format(r=item.row, c=item.column) - self.assertEquals(item.value, text) + self.assertEqual(item.value, text) def test_some_treeview_content(self): """ @@ -52,8 +53,8 @@ def test_some_treeview_content(self): """ model = self.funq.widget('treeview').model_items() - item = model.item_by_named_path([u"item 1", u"item 1-2"]) - parent_item = model.item_by_named_path([u"item 1"]) + item = model.item_by_named_path(["item 1", "item 1-2"]) + parent_item = model.item_by_named_path(["item 1"]) - self.assertEquals(item.value, u"item 1-2") + self.assertEqual(item.value, "item 1-2") self.assertIn(item, parent_item.items) diff --git a/client/funq/aliases.py b/client/funq/aliases.py index 03bea0f..568eb91 100644 --- a/client/funq/aliases.py +++ b/client/funq/aliases.py @@ -37,8 +37,10 @@ complete widget's paths. """ -from ConfigParser import ConfigParser +from __future__ import print_function, division, absolute_import, unicode_literals + import collections +from six.moves.configparser import ConfigParser from funq.errors import HooqAliasesInvalidLineError, HooqAliasesKeyError diff --git a/client/funq/client.py b/client/funq/client.py index 5ce8ccb..c7c359f 100644 --- a/client/funq/client.py +++ b/client/funq/client.py @@ -37,6 +37,8 @@ :class:`FunqClient`. """ +from __future__ import print_function, division, absolute_import, unicode_literals + import socket import json import errno @@ -46,6 +48,7 @@ import base64 from collections import defaultdict import logging +import six from funq.aliases import HooqAliases from funq.tools import wait_for @@ -55,14 +58,6 @@ LOG = logging.getLogger('funq.client') -# python 3 compatibility -# https://stackoverflow.com/questions/11301138/how-to-check-if-variable-is-string-with-python-2-and-3-compatibility) -try: - basestring -except NameError: - basestring = str - - class FunqClient(object): """ @@ -82,7 +77,7 @@ def __init__(self, host=None, port=None, aliases=None, if aliases is None: aliases = HooqAliases() - elif isinstance(aliases, basestring): + elif isinstance(aliases, six.string_types): aliases = HooqAliases.from_file(aliases) elif not isinstance(aliases, HooqAliases): raise TypeError("aliases must be None or str or an" @@ -156,8 +151,8 @@ def send_command(self, action, **kwargs): header = f.readline() if not header: raise FunqError("NoResponseFromApplication", - u"Pas de réponse de l'application testée -" - u" probablement un crash.") + "Pas de réponse de l'application testée -" + " probablement un crash.") to_read = int(header) response = json.loads(f.read(to_read).decode('utf-8')) if response.get('success') is False: @@ -323,7 +318,7 @@ def dump_widgets_list(self, stream='widgets_list.json', """ Write in a file the result of :meth:`widgets_list`. """ - if isinstance(stream, basestring): + if isinstance(stream, six.string_types): stream = open(stream, 'w') json.dump(self.widgets_list(with_properties=with_properties), stream, sort_keys=True, indent=4, separators=(',', ': ')) @@ -333,7 +328,7 @@ def take_screenshot(self, stream='screenshot.png', format_='PNG'): Take a screenshot of the active desktop. """ data = self.send_command('grab', format=format_) - if isinstance(stream, basestring): + if isinstance(stream, six.string_types): stream = open(stream, 'wb') raw = base64.standard_b64decode(data['data']) stream.write(raw) # pylint: disable=E1103 diff --git a/client/funq/errors.py b/client/funq/errors.py index 3c5b9ba..c730831 100644 --- a/client/funq/errors.py +++ b/client/funq/errors.py @@ -36,6 +36,8 @@ Defines error classes used in funq. """ +from __future__ import print_function, division, absolute_import, unicode_literals + class FunqError(Exception): @@ -49,7 +51,7 @@ class FunqError(Exception): def __init__(self, classname, desc): self.classname = classname self.desc = desc - Exception.__init__(self, u"{classname}: {desc}".format( + Exception.__init__(self, "{classname}: {desc}".format( classname=classname, desc=desc)) diff --git a/client/funq/models.py b/client/funq/models.py index 28b169e..119b2c9 100644 --- a/client/funq/models.py +++ b/client/funq/models.py @@ -35,18 +35,14 @@ """ Definition of widgets and models useable in funq. """ + +from __future__ import print_function, division, absolute_import, unicode_literals + from funq.tools import wait_for from funq.errors import FunqError import json import base64 - - -# python 3 compatibility -# https://stackoverflow.com/questions/11301138/how-to-check-if-variable-is-string-with-python-2-and-3-compatibility) -try: - basestring -except NameError: - basestring = str +import six class TreeItem(object): # pylint: disable=R0903 @@ -64,7 +60,7 @@ def create(cls, client, data): """ self = cls() self.client = client - for k, v in data.iteritems(): + for k, v in data.items(): if k != 'items': setattr(self, k, v) self.items = [cls.create(client, d) for d in data.get('items', [])] @@ -128,6 +124,7 @@ def __new__(mcs, name, bases, attrs): return cls +@six.add_metaclass(WidgetMetaClass) class Object(object): """ @@ -141,8 +138,6 @@ class Object(object): in inheritance order (ie 'QObject' is last) [type : list(str)] """ - __metaclass__ = WidgetMetaClass - oid = None client = None path = None @@ -161,7 +156,7 @@ def create(cls, client, data): break self = cls() - for k, v in data.iteritems(): + for k, v in data.items(): setattr(self, k, v) setattr(self, 'client', client) return self @@ -209,7 +204,7 @@ def wait_for_properties(self, props, timeout=10.0, timeout_interval=0.1): """ def check_props(): properties = self.properties() - for k, v in props.iteritems(): + for k, v in props.items(): if properties.get(k) != v: return False return True @@ -787,7 +782,7 @@ def dump_gitems(self, stream='gitems.json'): Write in a file the list of graphics items. """ data = self.client.send_command('graphicsitems', oid=self.oid) - if isinstance(stream, basestring): + if isinstance(stream, six.string_types): stream = open(stream, 'w') json.dump(data, stream, sort_keys=True, indent=4, separators=(',', ': ')) @@ -802,7 +797,7 @@ def grab_scene(self, stream, format_="PNG"): data = self.client.send_command('grab_graphics_view', format=format_, oid=self.oid) has_to_be_closed = False - if isinstance(stream, basestring): + if isinstance(stream, six.string_types): stream = open(stream, 'wb') has_to_be_closed = True raw = base64.standard_b64decode(data['data']) @@ -830,7 +825,7 @@ def set_current_text(self, text): """ Define the text of the combobox, ensuring that it is a possible value. """ - if not isinstance(text, basestring): + if not isinstance(text, six.string_types): raise TypeError('the text parameter must be a string' ' - got %s' % type(text)) column = self.properties()['modelColumn'] diff --git a/client/funq/noseplugin.py b/client/funq/noseplugin.py index 22402a4..17c2d6a 100644 --- a/client/funq/noseplugin.py +++ b/client/funq/noseplugin.py @@ -36,13 +36,15 @@ Module that integrates funq with nosetests. """ +from __future__ import print_function, division, absolute_import, unicode_literals + from funq.client import ApplicationRegistry from funq.testcase import MultiFunqTestCase, FunqTestCase, \ register_funq_app_registry from funq.screenshoter import ScreenShoter from funq import tools from nose.plugins import Plugin -from ConfigParser import ConfigParser +from six.moves.configparser import ConfigParser import os import codecs import logging @@ -149,7 +151,7 @@ def configure(self, options, cfg): FunqPlugin._instance = self def beforeTest(self, test): - message = u"Starting test `%s`" % test.id() + message = "Starting test `%s`" % test.id() lines = message_with_sep(message) for line in lines: LOG.info(line) @@ -160,7 +162,7 @@ def beforeTest(self, test): f.write('\n') def afterTest(self, test): - message = u"Ending test `%s`" % test.id() + message = "Ending test `%s`" % test.id() lines = message_with_sep(message) for line in lines: LOG.info(line) @@ -171,12 +173,12 @@ def afterTest(self, test): f.write('\n') def describeTest(self, test): - return u'%s' % test.id() + return '%s' % test.id() def take_screenshot(self, test): if isinstance(test, MultiFunqTestCase): if test.__app_config__: - for k, v in test.__app_config__.iteritems(): + for k, v in test.__app_config__.items(): if v.screenshot_on_error: self.screenshoter.take_screenshot( test.funq[k], diff --git a/client/funq/screenshoter.py b/client/funq/screenshoter.py index 25e19c8..92e9403 100644 --- a/client/funq/screenshoter.py +++ b/client/funq/screenshoter.py @@ -37,10 +37,13 @@ automatically. """ +from __future__ import print_function, division, absolute_import, unicode_literals + import os import itertools import logging import codecs +import six LOG = logging.getLogger('funq.screenshoter') @@ -67,7 +70,7 @@ def take_screenshot(self, funqclient, longname): if not os.path.isdir(self.working_folder): os.makedirs(self.working_folder) - bname = '{0}.png'.format(self.counter.next()) + bname = '{0}.png'.format(six.next(self.counter)) fname = os.path.join(self.working_folder, bname) try: @@ -75,9 +78,9 @@ def take_screenshot(self, funqclient, longname): except (SystemExit, KeyboardInterrupt): raise except Exception: - LOG.exception(u"impossible de prendre un screenshot pour" - u" %s", longname) + LOG.exception("impossible de prendre un screenshot pour" + " %s", longname) return with codecs.open(self.txt_file_path, "a", "utf-8") as f: - f.write(u"{0}: {1}\n".format(bname, longname)) + f.write("{0}: {1}\n".format(bname, longname)) diff --git a/client/funq/testcase.py b/client/funq/testcase.py index 6b686fb..48cd1e2 100644 --- a/client/funq/testcase.py +++ b/client/funq/testcase.py @@ -36,6 +36,8 @@ funq integration in TestCase subclasses. """ +from __future__ import print_function, division, absolute_import, unicode_literals + import unittest import weakref from functools import wraps @@ -43,14 +45,7 @@ import os import re import inspect - - -# python 3 compatibility -# https://stackoverflow.com/questions/11301138/how-to-check-if-variable-is-string-with-python-2-and-3-compatibility) -try: - unicode -except NameError: - unicode = str +import six class AssertionSuccessError(AssertionError): @@ -67,7 +62,7 @@ def __init__(self, name): self.name = name def __str__(self): - return u"Test %s passed but it is decorated as TODO" % self.name + return "Test %s passed but it is decorated as TODO" % self.name def __rep__(self): return self.__str__() @@ -100,8 +95,8 @@ def wrapper(*args, **kwargs): try: func(*args, **kwargs) except exception_cls as err: - err = u"%s" % err - if isinstance(err, unicode): + err = "%s" % err + if isinstance(err, six.text_type): err = err.encode( 'utf-8', errors='ignore') # pylint: disable=E1103 skip_msg = skip_message.encode('utf-8', errors='ignore') @@ -188,7 +183,7 @@ def wraps_parameterized(func, func_suffix, args, kwargs): def wrapper(self): return func(self, *args, **kwargs) - wrapper.__name__ = func.__name__ + '_' + func_suffix + wrapper.__name__ = ('%s_%s' % (func.__name__.decode('ascii'), func_suffix)).encode('ascii') wrapper.__doc__ = '[%s] %s' % (func_suffix, func.__doc__) return wrapper @@ -202,7 +197,7 @@ class MetaParameterized(type): RE_ESCAPE_BAD_CHARS = re.compile(r'[\.\(\) -/]') def __new__(cls, name, bases, attrs): - for k, v in attrs.items(): + for k, v in list(attrs.items()): if callable(v) and hasattr(v, 'parameters'): for func_suffix, args, kwargs in v.parameters: func_suffix = cls.RE_ESCAPE_BAD_CHARS.sub('_', func_suffix) @@ -246,6 +241,7 @@ def register_funq_app_registry(registry): BaseTestCase.__app_registry__ = registry +@six.add_metaclass(MetaParameterized) class BaseTestCase(unittest.TestCase): """ @@ -255,9 +251,8 @@ class BaseTestCase(unittest.TestCase): :class:`MetaParameterized` that allows to generate methods from data. It inherits from :class:`unittest.TestCase`, thus allowing to use very - useful methods like assertEquals, assertFalse, etc. + useful methods like assertEqual, assertFalse, etc. """ - __metaclass__ = MetaParameterized __app_registry__ = None longMessage = True @@ -279,7 +274,7 @@ def __delete_funq_ctx(self): def id(self): cls = self.__class__ fname = inspect.getsourcefile(cls)[len(os.getcwd()) + 1:] - return u"%s:%s.%s" % (fname, cls.__name__, self._testMethodName) + return "%s:%s.%s" % (fname, cls.__name__, self._testMethodName) class FunqTestCase(BaseTestCase): diff --git a/client/funq/tests/__init__.py b/client/funq/tests/__init__.py index bc1862b..3baa64a 100644 --- a/client/funq/tests/__init__.py +++ b/client/funq/tests/__init__.py @@ -1,3 +1,5 @@ +from __future__ import print_function, division, absolute_import, unicode_literals + import os from nose.loader import TestLoader from nose.suite import LazySuite diff --git a/client/funq/tests/test_aliases.py b/client/funq/tests/test_aliases.py index 78b3a0a..0d6afe9 100644 --- a/client/funq/tests/test_aliases.py +++ b/client/funq/tests/test_aliases.py @@ -32,6 +32,8 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL v2.1 license and that you accept its terms. +from __future__ import print_function, division, absolute_import, unicode_literals + from nose.tools import assert_equals, raises from funq.aliases import HooqAliases, HooqAliasesInvalidLineError,\ HooqAliasesKeyError diff --git a/client/funq/tests/test_client.py b/client/funq/tests/test_client.py index 106c78b..e48cfb5 100644 --- a/client/funq/tests/test_client.py +++ b/client/funq/tests/test_client.py @@ -32,13 +32,14 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL v2.1 license and that you accept its terms. +from __future__ import print_function, division, absolute_import, unicode_literals + from nose.tools import assert_equals, raises +from six.moves.configparser import ConfigParser, NoOptionError from funq import client import os import subprocess -from ConfigParser import ConfigParser, NoOptionError - class ApplicationConfig(client.ApplicationConfig): pass @@ -47,7 +48,7 @@ class ApplicationConfig(client.ApplicationConfig): class GlobalOptions(object): def __init__(self, **kwds): - for k, v in kwds.iteritems(): + for k, v in kwds.items(): setattr(self, k, v) diff --git a/client/funq/tests/test_models.py b/client/funq/tests/test_models.py index df744d3..9f5ad84 100644 --- a/client/funq/tests/test_models.py +++ b/client/funq/tests/test_models.py @@ -32,6 +32,8 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL v2.1 license and that you accept its terms. +from __future__ import print_function, division, absolute_import, unicode_literals + from nose.tools import assert_is_instance, assert_equals from funq import models diff --git a/client/funq/tests/test_noseplugin.py b/client/funq/tests/test_noseplugin.py index 31f89ac..9011bb4 100644 --- a/client/funq/tests/test_noseplugin.py +++ b/client/funq/tests/test_noseplugin.py @@ -32,6 +32,8 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL v2.1 license and that you accept its terms. +from __future__ import print_function, division, absolute_import, unicode_literals + from nose.tools import assert_equals, assert_true from funq import noseplugin, tools from optparse import OptionParser diff --git a/client/funq/tests/test_screenshoter.py b/client/funq/tests/test_screenshoter.py index f31f2d5..6c88c0d 100644 --- a/client/funq/tests/test_screenshoter.py +++ b/client/funq/tests/test_screenshoter.py @@ -32,11 +32,13 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL v2.1 license and that you accept its terms. +from __future__ import print_function, division, absolute_import, unicode_literals + from nose.tools import assert_equals, assert_true from funq import screenshoter import tempfile import shutil -import os +from os import path class FakeFunqClient(object): @@ -64,9 +66,9 @@ def test_take_one_screenshot(): funq = FakeFunqClient() with ScreenShoterCtx() as ctx: ctx.take_screenshot(funq, "hello") - assert_equals(map(os.path.basename, funq.screens), ["0.png"]) + assert_equals([path.basename(s) for s in funq.screens], ["0.png"]) assert_true("0.png: hello" in open( - os.path.join(ctx.working_folder, 'images.txt')).read()) + path.join(ctx.working_folder, 'images.txt')).read()) def test_take_screenshots(): @@ -76,7 +78,7 @@ def test_take_screenshots(): ctx.take_screenshot(funq, "thisisit") - assert_equals(map(os.path.basename, funq.screens), ["0.png", "1.png"]) - content = open(os.path.join(ctx.working_folder, 'images.txt')).read() + assert_equals([path.basename(s) for s in funq.screens], ["0.png", "1.png"]) + content = open(path.join(ctx.working_folder, 'images.txt')).read() assert_true("0.png: hello" in content) assert_true("1.png: thisisit" in content) diff --git a/client/funq/tests/test_tools.py b/client/funq/tests/test_tools.py index 2836a7b..56b434c 100644 --- a/client/funq/tests/test_tools.py +++ b/client/funq/tests/test_tools.py @@ -32,6 +32,8 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL v2.1 license and that you accept its terms. +from __future__ import print_function, division, absolute_import, unicode_literals + from nose.tools import assert_equals, assert_true, raises from funq import tools import time diff --git a/client/funq/tools.py b/client/funq/tools.py index 562e804..d0bfaf1 100644 --- a/client/funq/tools.py +++ b/client/funq/tools.py @@ -36,6 +36,8 @@ Tools for funq. """ +from __future__ import print_function, division, absolute_import, unicode_literals + import os import platform import time diff --git a/client/setup.py b/client/setup.py index a4557a9..5a9063e 100644 --- a/client/setup.py +++ b/client/setup.py @@ -15,9 +15,9 @@ def read(*paths): version = re.search("__version__ = '(.+)'", read('funq/__init__.py')).group(1) -# nose n'est actuellement pas requis pour ce module -# mais tres utile pour cadrer les tests. -install_requires = ['nose'] +# Nose isn't really needed for this mdoule, +# but it's useful for running tests. +install_requires = ['nose', 'six'] setup( name="funq", @@ -29,7 +29,6 @@ def read(*paths): version=version, packages=find_packages(), zip_safe=False, - use_2to3=True, test_suite='funq.tests.create_test_suite', install_requires=install_requires, package_data={'funq': ['aliases-gkits.conf']}, diff --git a/tests-functionnal/test_action.py b/tests-functionnal/test_action.py index d40d452..ac17dc0 100644 --- a/tests-functionnal/test_action.py +++ b/tests-functionnal/test_action.py @@ -41,7 +41,7 @@ def test_blocking_trigger_to_nonblocking_action(self): self.start_dialog('action') action = self.funq.action(path='mainWindow::ActionDialog::nonblockingAction') action.trigger(blocking=True) - self.assertEquals(self.get_status_text(), 'nonblocking triggered !') + self.assertEqual(self.get_status_text(), 'nonblocking triggered !') def test_nonblocking_trigger_to_blocking_action(self): self.start_dialog('action') @@ -51,4 +51,4 @@ def test_nonblocking_trigger_to_blocking_action(self): btn = self.funq.widget(path='QMessageBox::qt_msgbox_buttonbox::QPushButton') btn.click() # now the status text must be updated - self.assertEquals(self.get_status_text(), 'blocking triggered !') + self.assertEqual(self.get_status_text(), 'blocking triggered !') diff --git a/tests-functionnal/test_click.py b/tests-functionnal/test_click.py index 06baf14..fc8f254 100644 --- a/tests-functionnal/test_click.py +++ b/tests-functionnal/test_click.py @@ -42,25 +42,25 @@ def test_simple_click(self): self.start_dialog('click') btn = self.funq.widget(path='mainWindow::ClickDialog::QPushButton') btn.click() - self.assertEquals(self.get_status_text(), 'clicked !') + self.assertEqual(self.get_status_text(), 'clicked !') def test_right_click(self): self.start_dialog('widgetclick') btn = self.funq.widget(path='mainWindow::WidgetClickDialog') btn.click(btn='right') - self.assertEquals(self.get_status_text(), 'right clicked !') + self.assertEqual(self.get_status_text(), 'right clicked !') def test_middle_click(self): self.start_dialog('widgetclick') btn = self.funq.widget(path='mainWindow::WidgetClickDialog') btn.click(btn='middle') - self.assertEquals(self.get_status_text(), 'middle clicked !') + self.assertEqual(self.get_status_text(), 'middle clicked !') def test_double_click(self): self.start_dialog('doubleclick') btn = self.funq.widget(path='mainWindow::DoubleClickDialog') btn.dclick() - self.assertEquals(self.get_status_text(), 'double clicked !') + self.assertEqual(self.get_status_text(), 'double clicked !') @parameterized('sometext', 'Hello this is me !') @parameterized('someothertext', 'AAAA BBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCC') @@ -68,7 +68,7 @@ def test_key_click(self, text): self.start_dialog('keyclick') line = self.funq.widget(path='mainWindow::KeyClickDialog::QLineEdit') line.keyclick(text) - self.assertEquals(self.get_status_text(), text) + self.assertEqual(self.get_status_text(), text) @parameterized('R1', 'H', 0, 0) @parameterized('R1_by_name', 'H', 'C1', 0) @@ -77,7 +77,7 @@ def test_click_header(self, orientation, index_or_name, result_index): self.start_dialog('table') header = self.funq.widget(path='mainWindow::TableDialog::QTableWidget::' + orientation) header.header_click(index_or_name) - self.assertEquals( + self.assertEqual( self.get_status_text(), orientation + " Header clicked: " + str(result_index) ) diff --git a/tests-functionnal/test_injection.py b/tests-functionnal/test_injection.py index f363cd2..3768300 100644 --- a/tests-functionnal/test_injection.py +++ b/tests-functionnal/test_injection.py @@ -60,4 +60,4 @@ def test_close_blocking_msgbox_at_startup(self): btn.click() # now the main window should be visible window = self.funq.widget(path='mainWindow::QWidget') - self.assertEquals(window.properties()['visible'], True) + self.assertEqual(window.properties()['visible'], True) diff --git a/tests-functionnal/test_retrieve_widget.py b/tests-functionnal/test_retrieve_widget.py index d8d7ae5..b75ba84 100644 --- a/tests-functionnal/test_retrieve_widget.py +++ b/tests-functionnal/test_retrieve_widget.py @@ -50,8 +50,8 @@ def test_widget(self, alias=None, path=None): self.assertIsInstance(lbl, Widget) self.assertIsInstance(lbl.client, FunqClient) - self.assertEquals(lbl.path, 'mainWindow::RetrieveWidget::QLabel') - self.assertEquals(lbl.classes, [u'QLabel', u'QFrame', u'QWidget', u'QObject']) + self.assertEqual(lbl.path, 'mainWindow::RetrieveWidget::QLabel') + self.assertEqual(lbl.classes, [u'QLabel', u'QFrame', u'QWidget', u'QObject']) self.assertTrue(lbl.oid) def test_widget_alias_unknow(self): @@ -71,33 +71,33 @@ def test_widget_property(self): self.start_dialog('retrieve') lbl = self.funq.widget('lbl_retrieve') - self.assertEquals(lbl.properties()['text'], 'hello') + self.assertEqual(lbl.properties()['text'], 'hello') def test_widget_set_property(self): self.start_dialog('retrieve') lbl = self.funq.widget('lbl_retrieve') lbl.set_property('text', 'hello2') - self.assertEquals(lbl.properties()['text'], 'hello2') + self.assertEqual(lbl.properties()['text'], 'hello2') def test_widget_set_properties(self): self.start_dialog('retrieve') lbl = self.funq.widget('lbl_retrieve') lbl.set_properties(text='hello2', wordWrap=True) - self.assertEquals(lbl.properties()['text'], 'hello2') - self.assertEquals(lbl.properties()['wordWrap'], True) + self.assertEqual(lbl.properties()['text'], 'hello2') + self.assertEqual(lbl.properties()['wordWrap'], True) def test_widget_active(self): self.start_dialog('retrieve') self.funq.widget(path='mainWindow::RetrieveWidget') # wait for the dialog to be shown active = self.funq.active_widget('modal') - self.assertEquals(active.path, 'mainWindow::RetrieveWidget') + self.assertEqual(active.path, 'mainWindow::RetrieveWidget') @parameterized('V', 'V', ['R1', 'R2']) @parameterized('H', 'H', ['C1', 'C2', 'C3']) def test_headertexts(self, orientation, texts): self.start_dialog('table') header = self.funq.widget(path='mainWindow::TableDialog::QTableWidget::' + orientation) - self.assertEquals(header.header_texts(), texts) + self.assertEqual(header.header_texts(), texts) def test_header_from_table(self): self.start_dialog('table') diff --git a/tests-functionnal/test_shortcut.py b/tests-functionnal/test_shortcut.py index bbac1dc..6d4dce9 100644 --- a/tests-functionnal/test_shortcut.py +++ b/tests-functionnal/test_shortcut.py @@ -47,7 +47,7 @@ def test_shortcut(self, sequence): dlg = self.funq.active_widget('modal') dlg.shortcut(sequence) - self.assertEquals(self.get_status_text(), "Shortcut: " + sequence) + self.assertEqual(self.get_status_text(), "Shortcut: " + sequence) @parameterized("CTRL+C,F2", ["CTRL+C", "F2"]) @parameterized("CTRL+C,F2,ENTER", ["CTRL+C", "F2", "ENTER"]) @@ -58,10 +58,10 @@ def test_multi_shortcut(self, sequences): for sequence in sequences: dlg.shortcut(sequence) - self.assertEquals(self.get_status_text(), "Shortcut: " + sequence) + self.assertEqual(self.get_status_text(), "Shortcut: " + sequence) def test_on_push_button(self): self.start_dialog('click') btn = self.funq.widget(path='mainWindow::ClickDialog::QPushButton') btn.shortcut("ENTER") - self.assertEquals(self.get_status_text(), 'clicked !') + self.assertEqual(self.get_status_text(), 'clicked !')