diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index a11987dae075a4a45ed510be3807d52853af6f79..73b42c102cb80eff5253d8c3128e2a4127be2da4 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -1,6 +1,6 @@ from openerp.addons.account.tests.account_test_classes import AccountingTestCase import time -import unittest2 +import unittest class TestReconciliation(AccountingTestCase): @@ -209,7 +209,7 @@ class TestReconciliation(AccountingTestCase): self.account_rcv.id: {'debit': 42.0, 'credit': 0.0, 'amount_currency': 50, 'currency_id': self.currency_swiss_id}, }) - @unittest2.skip('adapt to new accounting') + @unittest.skip('adapt to new accounting') def test_balanced_exchanges_gain_loss(self): # The point of this test is to show that we handle correctly the gain/loss exchanges during reconciliations in foreign currencies. # For instance, with a company set in EUR, and a USD rate set to 0.033, diff --git a/addons/sale/tests/test_product_id_change.py b/addons/sale/tests/test_product_id_change.py index e6cb0267a172fd0260fce470491695a2544af125..fd53b431235ce4eb19ddfaff748066c30b3feac4 100644 --- a/addons/sale/tests/test_product_id_change.py +++ b/addons/sale/tests/test_product_id_change.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest from openerp.tests.common import TransactionCase class TestProductIdChange(TransactionCase): @@ -17,7 +17,7 @@ class TestProductIdChange(TransactionCase): self.product_model = self.registry('product.product') self.so_line_model = self.registry('sale.order.line') - @unittest2.skip(""" + @unittest.skip(""" Due to `sale` rewrite (94716a3f14d929574c46ef165e4364d12a5903ed), the commit 503820acb6d82a85c0c49ac26f7e7f8cd73851dd has been partially ignored during the forward-port to master and need to be rewritten using new-api. diff --git a/addons/web/tests/test_menu.py b/addons/web/tests/test_menu.py index d0674d247d513d0ed8e96a10d8b29a7c97c65c0a..c85684bdf84614071b8bd8a3814bafd7cd1cb9c8 100644 --- a/addons/web/tests/test_menu.py +++ b/addons/web/tests/test_menu.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest from ..controllers import main -class ActionMungerTest(unittest2.TestCase): +class ActionMungerTest(unittest.TestCase): def test_actual_treeview(self): action = { "views": [[False, "tree"], [False, "form"], diff --git a/addons/web/tests/test_serving_base.py b/addons/web/tests/test_serving_base.py index 10545a3efb45de232f4dd20ad55e3bbba2915909..e9689fcb1e3343fd00ebfadfc039c5062314f95d 100644 --- a/addons/web/tests/test_serving_base.py +++ b/addons/web/tests/test_serving_base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import random -import unittest2 +import unittest from openerp.tools import topological_sort @@ -10,7 +10,7 @@ def sample(population): population, random.randint(0, min(len(population), 5))) -class TestModulesLoading(unittest2.TestCase): +class TestModulesLoading(unittest.TestCase): def setUp(self): self.mods = map(str, range(1000)) def test_topological_sort(self): diff --git a/addons/web_editor/tests/test_converter.py b/addons/web_editor/tests/test_converter.py index ec8124b66b59dc64e2b2c5c528344944ff432b62..48a157c5d17d23d716c172a90d35e7da9d775bbd 100644 --- a/addons/web_editor/tests/test_converter.py +++ b/addons/web_editor/tests/test_converter.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import textwrap -import unittest2 +import unittest from lxml import etree, html from lxml.builder import E @@ -10,7 +10,7 @@ from openerp.addons.base.ir import ir_qweb from openerp.addons.web_editor.models.ir_qweb import html_to_text -class TestHTMLToText(unittest2.TestCase): +class TestHTMLToText(unittest.TestCase): def test_rawstring(self): self.assertEqual( "foobar", diff --git a/addons/website/tests/test_converter.py b/addons/website/tests/test_converter.py index ba60e2fac95dfb10c73c095a5774159fdda1ea89..2644a838dfc4b24961e541e314bdab4a390c6fc8 100644 --- a/addons/website/tests/test_converter.py +++ b/addons/website/tests/test_converter.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest from openerp.addons.website.models.website import slugify, unslug - -class TestUnslug(unittest2.TestCase): +class TestUnslug(unittest.TestCase): def test_unslug(self): tests = { '': (None, None), @@ -24,7 +23,7 @@ class TestUnslug(unittest2.TestCase): self.assertEqual(unslug(slug), expected) -class TestTitleToSlug(unittest2.TestCase): +class TestTitleToSlug(unittest.TestCase): """ Those tests should pass with or without python-slugify See website/models/website.py slugify method diff --git a/addons/website/tests/test_views.py b/addons/website/tests/test_views.py index b63ac75997dc3bad1195120ed1282e93e1667cae..9ab3e77c98756f24e2a88cfa60a78f63ee55366e 100644 --- a/addons/website/tests/test_views.py +++ b/addons/website/tests/test_views.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import itertools -import unittest2 +import unittest from lxml import etree as ET, html from lxml.html import builder as h @@ -61,7 +61,7 @@ class TestViewSaving(common.TransactionCase): company = self.registry('res.company').browse(self.cr, self.uid, 1) self.assertEqual(company.phone, "+00 00 000 00 0 000") - @unittest2.skip("save conflict for embedded (saved by third party or previous version in page) not implemented") + @unittest.skip("save conflict for embedded (saved by third party or previous version in page) not implemented") def test_embedded_conflict(self): e1 = h.SPAN("My Company", attrs(model='res.company', id=1, field='name')) e2 = h.SPAN("Leeroy Jenkins", attrs(model='res.company', id=1, field='name')) diff --git a/debian/control b/debian/control index 1b1c9d5531fe33d4cfee5969af37a6ed99b210c5..75e40dfe59d5631753e8a6e09235dccd809ac9ae 100644 --- a/debian/control +++ b/debian/control @@ -44,7 +44,6 @@ Depends: python-simplejson, python-suds, python-tz, - python-unittest2, python-vatnumber, python-vobject, python-werkzeug, diff --git a/doc/reference/javascript.rst b/doc/reference/javascript.rst index 609fe58d3d9449ce436aa229a75a5b1d8aa26a5a..d7dd2f70b709e0e126e5cdbef96e4dc07abbf3c6 100644 --- a/doc/reference/javascript.rst +++ b/doc/reference/javascript.rst @@ -1330,11 +1330,6 @@ command-line (or in a CI system), but while actually running it is pretty simple the setup of the pre-requisite parts has some complexities. -#. Install unittest2_ in your Python environment. Both - can trivially be installed via `pip <http://pip-installer.org>`_ or - `easy_install - <http://packages.python.org/distribute/easy_install.html>`_. - #. Install PhantomJS_. It is a headless browser which allows automating running and testing web pages. QUnitSuite_ uses it to actually run the qunit_ test suite. @@ -1402,8 +1397,6 @@ the OpenERP Web test suite. .. _qunit assertions: http://api.qunitjs.com/category/assert/ -.. _unittest2: http://pypi.python.org/pypi/unittest2 - .. _QUnitSuite: http://pypi.python.org/pypi/QUnitSuite/ .. _PhantomJS: http://phantomjs.org/ diff --git a/doc/reference/testing.rst b/doc/reference/testing.rst index 9523d732e0ff7200d07f0008fd8be9f4a0bb3131..53690426103a8135b460c317420b8154d8b4af62 100644 --- a/doc/reference/testing.rst +++ b/doc/reference/testing.rst @@ -7,7 +7,7 @@ Testing Modules =============== -Odoo provides support for testing modules using unittest2_. +Odoo provides support for testing modules using unittest. To write tests, simply define a ``tests`` sub-package in your module, it will be automatically inspected for test modules. Test modules should have a name @@ -80,5 +80,4 @@ Odoo server. As of Odoo 8, running tests outside of the install/update cycle is not supported. -.. _unittest2: http://pypi.python.org/pypi/unittest2 .. _unittest documentation: https://docs.python.org/2/library/unittest.html diff --git a/openerp/addons/base/tests/test_acl.py b/openerp/addons/base/tests/test_acl.py index b003a20415655216c6de60ffc4c9a4ec8a75fe58..635359c251e1b91808103444f6b0821904aceac1 100644 --- a/openerp/addons/base/tests/test_acl.py +++ b/openerp/addons/base/tests/test_acl.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest from lxml import etree from openerp.exceptions import AccessError @@ -165,4 +165,4 @@ class TestACL(common.TransactionCase): self.erp_manager_group.write({'users': [(3, self.demo_uid)]}) if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_base.py b/openerp/addons/base/tests/test_base.py index 0522595872fd7a11e70c7757b35989e66fdd24f4..11351a80517743b654f9370ad11bbe429bf8413c 100644 --- a/openerp/addons/base/tests/test_base.py +++ b/openerp/addons/base/tests/test_base.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest import openerp.tests.common as common from openerp.exceptions import ValidationError @@ -474,7 +474,7 @@ def tearDownModule(): global test_state test_state = None -class TestPhaseInstall00(unittest2.TestCase): +class TestPhaseInstall00(unittest.TestCase): """ WARNING: Relies on tests being run in alphabetical order """ @@ -494,7 +494,7 @@ class TestPhaseInstall00(unittest2.TestCase): self.state, 'init', "Testcase state should not have been transitioned from 00") -class TestPhaseInstall01(unittest2.TestCase): +class TestPhaseInstall01(unittest.TestCase): at_install = False def test_default_norun(self): @@ -504,7 +504,7 @@ class TestPhaseInstall01(unittest2.TestCase): def test_set_run(self): test_state['set_at_install'] = True -class TestPhaseInstall02(unittest2.TestCase): +class TestPhaseInstall02(unittest.TestCase): """ Can't put the check for test_set_run in the same class: if @common.at_install does not work for test_set_run, it won't work for @@ -520,4 +520,4 @@ class TestPhaseInstall02(unittest2.TestCase): "The flag should be set if local overriding of runstate") if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_basecase.py b/openerp/addons/base/tests/test_basecase.py index eb29308f5a81739ce58d7ff79fe80fc0ef0992d9..42b47749bf701352bff0f8b1edd503fb81c53543 100644 --- a/openerp/addons/base/tests/test_basecase.py +++ b/openerp/addons/base/tests/test_basecase.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest from openerp.tests import common @@ -83,4 +83,4 @@ class test_transaction_case(common.TransactionCase): self.assertEqual(partner, p_browse_ref, "browse_ref() should resolve xid to browse records") if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_db_cursor.py b/openerp/addons/base/tests/test_db_cursor.py index b4c5f3152c256c5dc48bd8d5bdef6f306734d74b..9fa61493f990199f65b0dc6e8ece48a66c6693bc 100644 --- a/openerp/addons/base/tests/test_db_cursor.py +++ b/openerp/addons/base/tests/test_db_cursor.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest import openerp from openerp.tools.misc import mute_logger @@ -12,7 +12,7 @@ def registry(): return openerp.modules.registry.RegistryManager.get(common.get_db_name()) -class test_cr_execute(unittest2.TestCase): +class test_cr_execute(unittest.TestCase): """ Try cr.execute with wrong parameters """ @mute_logger('openerp.sql_db') diff --git a/openerp/addons/base/tests/test_expression.py b/openerp/addons/base/tests/test_expression.py index ac336f334e01863ac74c28b7f3068e09e632292f..4bf112da1a92b6036f80bf7b5a750b9db11f4f27 100644 --- a/openerp/addons/base/tests/test_expression.py +++ b/openerp/addons/base/tests/test_expression.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest import openerp from openerp.osv.expression import get_unaccent_wrapper @@ -521,4 +521,4 @@ class test_expression(common.TransactionCase): self.env['res.users'].search([('name', '=', 'test')]) if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_func.py b/openerp/addons/base/tests/test_func.py index 6d9db8d04e3e9f937bacf6df0511fae57abd650b..d50b555265e487670f684083f6ae260c7eaca70d 100644 --- a/openerp/addons/base/tests/test_func.py +++ b/openerp/addons/base/tests/test_func.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import functools -import unittest2 +import unittest from openerp.tools.func import compose -class TestCompose(unittest2.TestCase): +class TestCompose(unittest.TestCase): def test_basic(self): str_add = compose(str, lambda a, b: a + b) self.assertEqual( diff --git a/openerp/addons/base/tests/test_ir_actions.py b/openerp/addons/base/tests/test_ir_actions.py index 0d1212a8e57d2d09f66bc0b87c62a59ba5c5dc7a..ee494ad84a7fd6b79c05af2031d49449ba99dfb1 100644 --- a/openerp/addons/base/tests/test_ir_actions.py +++ b/openerp/addons/base/tests/test_ir_actions.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest from openerp.exceptions import ValidationError import openerp.tests.common as common @@ -403,4 +403,4 @@ workflow""" if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_ir_sequence.py b/openerp/addons/base/tests/test_ir_sequence.py index 4d13ce6bd4a7250c92557e7aaf83b5637f9812be..3d2f891c63ec8e3df2701f7d01a69626649db28b 100644 --- a/openerp/addons/base/tests/test_ir_sequence.py +++ b/openerp/addons/base/tests/test_ir_sequence.py @@ -9,7 +9,7 @@ # This assume an existing database. import psycopg2 import psycopg2.errorcodes -import unittest2 +import unittest import openerp from openerp.tests import common @@ -31,7 +31,7 @@ def drop_sequence(code): cr.commit() cr.close() -class test_ir_sequence_standard(unittest2.TestCase): +class test_ir_sequence_standard(unittest.TestCase): """ A few tests for a 'Standard' (i.e. PostgreSQL) sequence. """ def test_ir_sequence_create(self): @@ -76,7 +76,7 @@ class test_ir_sequence_standard(unittest2.TestCase): def tearDownClass(cls): drop_sequence('test_sequence_type') -class test_ir_sequence_no_gap(unittest2.TestCase): +class test_ir_sequence_no_gap(unittest.TestCase): """ Copy of the previous tests for a 'No gap' sequence. """ def test_ir_sequence_create_no_gap(self): @@ -116,7 +116,7 @@ class test_ir_sequence_no_gap(unittest2.TestCase): def tearDownClass(cls): drop_sequence('test_sequence_type_2') -class test_ir_sequence_change_implementation(unittest2.TestCase): +class test_ir_sequence_change_implementation(unittest.TestCase): """ Create sequence objects and change their ``implementation`` field. """ def test_ir_sequence_1_create(self): @@ -156,7 +156,7 @@ class test_ir_sequence_change_implementation(unittest2.TestCase): drop_sequence('test_sequence_type_3') drop_sequence('test_sequence_type_4') -class test_ir_sequence_generate(unittest2.TestCase): +class test_ir_sequence_generate(unittest.TestCase): """ Create sequence objects and generate some values. """ def test_ir_sequence_create(self): @@ -224,4 +224,4 @@ class Test_ir_sequence_init(common.TransactionCase): assert read_sequence == "0001", 'The actual sequence value must be 1. reading : %s' % read_sequence if __name__ == "__main__": - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_ir_sequence_date_range.py b/openerp/addons/base/tests/test_ir_sequence_date_range.py index 6c4af69022183dde7f2f87000bdc0ff7bb7c74b1..c2ddc4e4f0fec212c8464d51fcbce9b04882c8c3 100644 --- a/openerp/addons/base/tests/test_ir_sequence_date_range.py +++ b/openerp/addons/base/tests/test_ir_sequence_date_range.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest from openerp.tests import common from datetime import date @@ -119,4 +119,4 @@ class test_ir_sequence_date_range_change_implementation(common.SingleTransaction if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_ir_values.py b/openerp/addons/base/tests/test_ir_values.py index c59f93a2db09bfa04bd8e76391e73eb34bf222d2..435421ea845cb0f9766c050de7596b2cc65e02dc 100644 --- a/openerp/addons/base/tests/test_ir_values.py +++ b/openerp/addons/base/tests/test_ir_values.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest import openerp.tests.common as common @@ -95,4 +95,4 @@ class test_ir_values(common.TransactionCase): assert isinstance(actions[0][2], dict) and actions[0][2]['id'] == report_id, 'Bound action does not match definition' if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_mail.py b/openerp/addons/base/tests/test_mail.py index 982a18f329e06d3f4019d92be3a92875b12aeea4..ec9877f895ddfe014beb1afcc87439abe978e8de 100644 --- a/openerp/addons/base/tests/test_mail.py +++ b/openerp/addons/base/tests/test_mail.py @@ -4,13 +4,13 @@ # > PYTHONPATH=. python2 openerp/tests/test_misc.py # Part of Odoo. See LICENSE file for full copyright and licensing details. -import unittest2 +import unittest from openerp.tools import html_sanitize, html_email_clean, append_content_to_html, plaintext2html, email_split import test_mail_examples -class TestSanitizer(unittest2.TestCase): +class TestSanitizer(unittest.TestCase): """ Test the html sanitizer that filters html to remove unwanted attributes """ def test_basic_sanitizer(self): @@ -111,7 +111,7 @@ class TestSanitizer(unittest2.TestCase): self.assertNotIn('</body></html>', html, 'html_sanitize did not remove extra closing tags') -class TestCleaner(unittest2.TestCase): +class TestCleaner(unittest.TestCase): """ Test the email cleaner function that filters the content of incoming emails """ def test_00_basic_text(self): @@ -340,7 +340,7 @@ class TestCleaner(unittest2.TestCase): self.assertNotIn('encoding', new_html, 'html_email_cleaner did not remove correctly encoding attributes') -class TestHtmlTools(unittest2.TestCase): +class TestHtmlTools(unittest.TestCase): """ Test some of our generic utility functions about html """ def test_plaintext2html(self): @@ -367,7 +367,7 @@ class TestHtmlTools(unittest2.TestCase): self.assertEqual(append_content_to_html(html, content, plaintext_flag, preserve_flag, container_tag), expected, 'append_content_to_html is broken') -class TestEmailTools(unittest2.TestCase): +class TestEmailTools(unittest.TestCase): """ Test some of our generic utility functions for emails """ def test_email_split(self): @@ -382,4 +382,4 @@ class TestEmailTools(unittest2.TestCase): self.assertEqual(email_split(text), expected, 'email_split is broken') if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_misc.py b/openerp/addons/base/tests/test_misc.py index 11cc3f49638b7e94fd53298aec2c0c099d27e8c1..d20a17403ff9eb931dbb55db24015f0c62084949 100644 --- a/openerp/addons/base/tests/test_misc.py +++ b/openerp/addons/base/tests/test_misc.py @@ -1,9 +1,9 @@ -import unittest2 +import unittest from openerp.tools import misc -class test_countingstream(unittest2.TestCase): +class test_countingstream(unittest.TestCase): def test_empty_stream(self): s = misc.CountingStream(iter([])) self.assertEqual(s.index, -1) @@ -34,4 +34,4 @@ class test_countingstream(unittest2.TestCase): self.assertEqual(s.index, 0) if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_res_config.py b/openerp/addons/base/tests/test_res_config.py index 450925a522c7242ed2bbb731c31753dbfe635166..0a6a49efdeb6d3fbc47a026db7c6ff9c8a474932 100644 --- a/openerp/addons/base/tests/test_res_config.py +++ b/openerp/addons/base/tests/test_res_config.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest import openerp import openerp.tests.common as common diff --git a/openerp/addons/base/tests/test_res_lang.py b/openerp/addons/base/tests/test_res_lang.py index 368ce71015827a8df163be8d6901792456f555ba..c7e591472c5367be4d1078cf70c3d5aaea89b375 100644 --- a/openerp/addons/base/tests/test_res_lang.py +++ b/openerp/addons/base/tests/test_res_lang.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest import openerp.tests.common as common diff --git a/openerp/addons/base/tests/test_search.py b/openerp/addons/base/tests/test_search.py index 32f6f93d95bad25468ddaa3934591375ee4fedc5..000f05a33d81908bef8db8fe0d5b73dc6e0b80aa 100644 --- a/openerp/addons/base/tests/test_search.py +++ b/openerp/addons/base/tests/test_search.py @@ -1,4 +1,4 @@ -import unittest2 +import unittest import openerp.tests.common as common @@ -161,4 +161,4 @@ class test_search(common.TransactionCase): self.assertEqual(search_result, expected_order) if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_uninstall.py b/openerp/addons/base/tests/test_uninstall.py index 233ffe97ce068295e71d460810930500258e18cf..8bb658d61ba17dbe7fd3caf2d8125bb93f0fef0a 100644 --- a/openerp/addons/base/tests/test_uninstall.py +++ b/openerp/addons/base/tests/test_uninstall.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # This assumes an existing but uninitialized database. -import unittest2 +import unittest import openerp from openerp import SUPERUSER_ID @@ -51,7 +51,7 @@ def uninstall_module(module_name): cr.close() reload_registry() -class test_uninstall(unittest2.TestCase): +class test_uninstall(unittest.TestCase): """ Test the install/uninstall of a test module. The module is available in `openerp.tests` which should be present in the addons-path. @@ -82,4 +82,4 @@ class test_uninstall(unittest2.TestCase): if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_view_validation.py b/openerp/addons/base/tests/test_view_validation.py index 4cd8b95bbaa87c4c86956016a0c399d6522ed94a..68d35e38d1c910a6307cf1601a5cb0fc70fee866 100644 --- a/openerp/addons/base/tests/test_view_validation.py +++ b/openerp/addons/base/tests/test_view_validation.py @@ -2,7 +2,7 @@ # > PYTHONPATH=. python2 openerp/tests/test_view_validation.py from lxml import etree from StringIO import StringIO -import unittest2 +import unittest from openerp.tools.view_validation import (valid_page_in_book, valid_att_in_form, valid_type_in_colspan, valid_type_in_col, valid_att_in_field, valid_att_in_label, @@ -92,7 +92,7 @@ valid_tree = etree.parse(StringIO('''\ ''')).getroot() -class test_view_validation(unittest2.TestCase): +class test_view_validation(unittest.TestCase): """ Test the view validation code (but not the views themselves). """ def test_page_validation(self): @@ -128,4 +128,4 @@ class test_view_validation(unittest2.TestCase): if __name__ == '__main__': - unittest2.main() + unittest.main() diff --git a/openerp/addons/base/tests/test_views.py b/openerp/addons/base/tests/test_views.py index d73bc8d851ad507ee411520b6d33826036929c74..bc7b5edf11ce9a3d2b4a21841daf7e2b3db6d79b 100644 --- a/openerp/addons/base/tests/test_views.py +++ b/openerp/addons/base/tests/test_views.py @@ -2,7 +2,7 @@ from functools import partial import itertools -import unittest2 +import unittest from lxml import etree as ET from lxml.builder import E diff --git a/openerp/addons/test_convert/tests/test_convert.py b/openerp/addons/test_convert/tests/test_convert.py index b6981d8db9ff35902383ff17a48697f2ef9fab2f..7d1c575b2c786674eadc311c9b06be3123e8ae55 100644 --- a/openerp/addons/test_convert/tests/test_convert.py +++ b/openerp/addons/test_convert/tests/test_convert.py @@ -1,5 +1,5 @@ import collections -import unittest2 +import unittest from lxml import etree as ET from lxml.builder import E @@ -72,10 +72,10 @@ class TestEvalXML(common.TransactionCase): with self.assertRaises(IOError): self.eval_xml(Field('test_nofile.txt', type='file'), obj) - @unittest2.skip("not tested") + @unittest.skip("not tested") def test_xml(self): pass - @unittest2.skip("not tested") + @unittest.skip("not tested") def test_html(self): pass diff --git a/openerp/addons/test_impex/tests/test_load.py b/openerp/addons/test_impex/tests/test_load.py index d9cbd5b100a06571d6f1e43ba0c7f72653481161..2739fc3cc3e2d9dd31643ab309490e45ee062434 100644 --- a/openerp/addons/test_impex/tests/test_load.py +++ b/openerp/addons/test_impex/tests/test_load.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import json import pkgutil -import unittest2 +import unittest import openerp.modules.registry import openerp diff --git a/openerp/modules/module.py b/openerp/modules/module.py index b03e31b3aa5a85a189a294b86644ed6d441410ae..bd46d05cde16031bd264b2e38beb2558f1ab6605 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -15,7 +15,7 @@ import unittest import threading from os.path import join as opj -import unittest2 +import unittest import openerp import openerp.tools as tools @@ -377,7 +377,7 @@ def adapt_version(version): def get_test_modules(module): """ Return a list of module for the addons potentially containing tests to - feed unittest2.TestLoader.loadTestsFromModule() """ + feed unittest.TestLoader.loadTestsFromModule() """ # Try to import the module modpath = 'openerp.addons.' + module try: @@ -446,14 +446,14 @@ def run_unit_tests(module_name, dbname, position=runs_at_install): threading.currentThread().testing = True r = True for m in mods: - tests = unwrap_suite(unittest2.TestLoader().loadTestsFromModule(m)) - suite = unittest2.TestSuite(itertools.ifilter(position, tests)) + tests = unwrap_suite(unittest.TestLoader().loadTestsFromModule(m)) + suite = unittest.TestSuite(itertools.ifilter(position, tests)) if suite.countTestCases(): t0 = time.time() t0_sql = openerp.sql_db.sql_counter _logger.info('%s running tests.', m.__name__) - result = unittest2.TextTestRunner(verbosity=2, stream=TestStream(m.__name__)).run(suite) + result = unittest.TextTestRunner(verbosity=2, stream=TestStream(m.__name__)).run(suite) if time.time() - t0 > 5: _logger.log(25, "%s tested in %.2fs, %s queries", m.__name__, time.time() - t0, openerp.sql_db.sql_counter - t0_sql) if not result.wasSuccessful(): @@ -471,8 +471,8 @@ def unwrap_suite(test): test suites). These can then be checked for run/skip attributes individually. - An alternative would be to use a variant of @unittest2.skipIf with a state - flag of some sort e.g. @unittest2.skipIf(common.runstate != 'at_install'), + An alternative would be to use a variant of @unittest.skipIf with a state + flag of some sort e.g. @unittest.skipIf(common.runstate != 'at_install'), but then things become weird with post_install as tests should *not* run by default there """ diff --git a/openerp/service/server.py b/openerp/service/server.py index b3ae669d169f258f9fb920f072acb7cb52bf63e1..f21699ddcf1c31f0e5b6373881f87d56ad8b2028 100644 --- a/openerp/service/server.py +++ b/openerp/service/server.py @@ -15,7 +15,7 @@ import subprocess import sys import threading import time -import unittest2 +import unittest import werkzeug.serving from werkzeug.debug import DebuggedApplication @@ -860,12 +860,12 @@ def load_test_file_py(registry, test_file): if mod_mod: mod_path, _ = os.path.splitext(getattr(mod_mod, '__file__', '')) if test_path == mod_path: - suite = unittest2.TestSuite() - for t in unittest2.TestLoader().loadTestsFromModule(mod_mod): + suite = unittest.TestSuite() + for t in unittest.TestLoader().loadTestsFromModule(mod_mod): suite.addTest(t) _logger.log(logging.INFO, 'running tests %s.', mod_mod.__name__) stream = openerp.modules.module.TestStream() - result = unittest2.TextTestRunner(verbosity=2, stream=stream).run(suite) + result = unittest.TextTestRunner(verbosity=2, stream=stream).run(suite) success = result.wasSuccessful() if hasattr(registry._assertion_report,'report_result'): registry._assertion_report.report_result(success) diff --git a/openerp/tests/common.py b/openerp/tests/common.py index 94f0536591371a17009e908859c29ad686d61600..852bbb2a349e42fa30c375bd4d8cf48837148704 100644 --- a/openerp/tests/common.py +++ b/openerp/tests/common.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -The module :mod:`openerp.tests.common` provides unittest2 test cases and a few +The module :mod:`openerp.tests.common` provides unittest test cases and a few helpers and classes to write tests. """ @@ -15,7 +15,7 @@ import subprocess import threading import time import itertools -import unittest2 +import unittest import urllib2 import xmlrpclib from contextlib import contextmanager @@ -79,7 +79,7 @@ def post_install(flag): return obj return decorator -class BaseCase(unittest2.TestCase): +class BaseCase(unittest.TestCase): """ Subclass of TestCase for common OpenERP-specific code. @@ -352,7 +352,7 @@ class HttpCase(TransactionCase): try: phantom = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=None) except OSError: - raise unittest2.SkipTest("PhantomJS not found") + raise unittest.SkipTest("PhantomJS not found") try: self.phantom_poll(phantom, timeout) finally: diff --git a/openerp/tools/assertion_report.py b/openerp/tools/assertion_report.py index 3f2664b1bb43149d977160cb1d67cbd60fbaa65d..729309915277cf958efcd8cd82e825939d5507f3 100644 --- a/openerp/tools/assertion_report.py +++ b/openerp/tools/assertion_report.py @@ -2,7 +2,7 @@ class assertion_report(object): """ Simple pair of success and failures counts (used to record YAML and XML - `assert` tags as well as unittest2 tests outcome (in this case, not + `assert` tags as well as unittest tests outcome (in this case, not individual `assert`)). """ def __init__(self): diff --git a/requirements.txt b/requirements.txt index 7b44c598c32e7473fa706b6ff3bdd2faede50e72..215b9ac13fba1cc2946ae7c03d3cf767802d6a87 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,7 +36,6 @@ requests==2.6.0 simplejson==3.6.5 six==1.9.0 suds-jurko==0.6 -unittest2==0.8.0 vatnumber==1.2 vobject==0.6.6 wsgiref==0.1.2 diff --git a/setup.cfg b/setup.cfg index 35676683d74cf9d21bd62c6f432a60e8330ce839..816d63a8304a271ec5e5ba64508993963b58e8da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,7 +26,6 @@ requires = python-reportlab python-requests python-simplejson - python-unittest2 python-vobject python-werkzeug python-yaml diff --git a/setup.py b/setup.py index d361fc61b707c1fef3827356c2f81b3708696337..824c8075c803e321ebf994e49863099c31fe8245 100644 --- a/setup.py +++ b/setup.py @@ -162,7 +162,6 @@ setup( 'requests', 'simplejson', 'suds-jurko', - 'unittest2', 'vatnumber', 'vobject', 'werkzeug', @@ -172,7 +171,6 @@ setup( 'SSL': ['pyopenssl'], }, tests_require=[ - 'unittest2', 'mock', ], **py2exe_options() diff --git a/setup/package.dfcentos b/setup/package.dfcentos index 76c2b2fbbce88ad0e5872d3d89a14513c2b126c9..8917a7cce434a07d02a50fd72ed866b01b42545c 100644 --- a/setup/package.dfcentos +++ b/setup/package.dfcentos @@ -30,7 +30,6 @@ RUN yum install -d 0 -e 0 epel-release -y && \ python-reportlab \ python-requests \ python-simplejson \ - python-unittest2 \ python-vobject \ python-werkzeug \ python-yaml \ diff --git a/setup/package.dfdebian b/setup/package.dfdebian index 283c11f4c4e03cfa90d3855efbd4bf0223965370..b84e7191aaa96697e93d501ceb2c8cee08c1ea90 100644 --- a/setup/package.dfdebian +++ b/setup/package.dfdebian @@ -48,7 +48,6 @@ RUN apt-get update -qq && \ python-simplejson \ python-suds \ python-tz \ - python-unittest2 \ python-vatnumber \ python-vobject \ python-werkzeug \