Skip to content

Commit 06b3026

Browse files
leorochaelmart-e
authored andcommitted
[IMP] unittest2 > unittest
The `unittest2` package is simply a backport of `unittest` from the Standard Library of Python 2.7 to previous versions. There is no reason to use it any longer. Closes odoo#6941
1 parent 864ac67 commit 06b3026

39 files changed

+83
-99
lines changed

addons/account/tests/test_reconciliation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
22
import time
3-
import unittest2
3+
import unittest
44

55
class TestReconciliation(AccountingTestCase):
66

@@ -209,7 +209,7 @@ def test_statement_euro_invoice_usd_transaction_chf(self):
209209
self.account_rcv.id: {'debit': 42.0, 'credit': 0.0, 'amount_currency': 50, 'currency_id': self.currency_swiss_id},
210210
})
211211

212-
@unittest2.skip('adapt to new accounting')
212+
@unittest.skip('adapt to new accounting')
213213
def test_balanced_exchanges_gain_loss(self):
214214
# The point of this test is to show that we handle correctly the gain/loss exchanges during reconciliations in foreign currencies.
215215
# For instance, with a company set in EUR, and a USD rate set to 0.033,

addons/sale/tests/test_product_id_change.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import unittest2
1+
import unittest
22
from openerp.tests.common import TransactionCase
33

44
class TestProductIdChange(TransactionCase):
@@ -17,7 +17,7 @@ def setUp(self):
1717
self.product_model = self.registry('product.product')
1818
self.so_line_model = self.registry('sale.order.line')
1919

20-
@unittest2.skip("""
20+
@unittest.skip("""
2121
Due to `sale` rewrite (94716a3f14d929574c46ef165e4364d12a5903ed),
2222
the commit 503820acb6d82a85c0c49ac26f7e7f8cd73851dd has been partially ignored
2323
during the forward-port to master and need to be rewritten using new-api.

addons/web/tests/test_menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# -*- coding: utf-8 -*-
2-
import unittest2
2+
import unittest
33

44
from ..controllers import main
55

66

7-
class ActionMungerTest(unittest2.TestCase):
7+
class ActionMungerTest(unittest.TestCase):
88
def test_actual_treeview(self):
99
action = {
1010
"views": [[False, "tree"], [False, "form"],

addons/web/tests/test_serving_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import random
4-
import unittest2
4+
import unittest
55

66
from openerp.tools import topological_sort
77

@@ -10,7 +10,7 @@ def sample(population):
1010
population,
1111
random.randint(0, min(len(population), 5)))
1212

13-
class TestModulesLoading(unittest2.TestCase):
13+
class TestModulesLoading(unittest.TestCase):
1414
def setUp(self):
1515
self.mods = map(str, range(1000))
1616
def test_topological_sort(self):

addons/web_editor/tests/test_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
import textwrap
3-
import unittest2
3+
import unittest
44

55
from lxml import etree, html
66
from lxml.builder import E
@@ -10,7 +10,7 @@
1010
from openerp.addons.web_editor.models.ir_qweb import html_to_text
1111

1212

13-
class TestHTMLToText(unittest2.TestCase):
13+
class TestHTMLToText(unittest.TestCase):
1414
def test_rawstring(self):
1515
self.assertEqual(
1616
"foobar",

addons/website/tests/test_converter.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
import unittest2
2+
import unittest
33
from openerp.addons.website.models.website import slugify, unslug
44

5-
6-
class TestUnslug(unittest2.TestCase):
5+
class TestUnslug(unittest.TestCase):
76
def test_unslug(self):
87
tests = {
98
'': (None, None),
@@ -24,7 +23,7 @@ def test_unslug(self):
2423
self.assertEqual(unslug(slug), expected)
2524

2625

27-
class TestTitleToSlug(unittest2.TestCase):
26+
class TestTitleToSlug(unittest.TestCase):
2827
"""
2928
Those tests should pass with or without python-slugify
3029
See website/models/website.py slugify method

addons/website/tests/test_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import itertools
33

4-
import unittest2
4+
import unittest
55
from lxml import etree as ET, html
66
from lxml.html import builder as h
77

@@ -61,7 +61,7 @@ def test_embedded_save(self):
6161
company = self.registry('res.company').browse(self.cr, self.uid, 1)
6262
self.assertEqual(company.phone, "+00 00 000 00 0 000")
6363

64-
@unittest2.skip("save conflict for embedded (saved by third party or previous version in page) not implemented")
64+
@unittest.skip("save conflict for embedded (saved by third party or previous version in page) not implemented")
6565
def test_embedded_conflict(self):
6666
e1 = h.SPAN("My Company", attrs(model='res.company', id=1, field='name'))
6767
e2 = h.SPAN("Leeroy Jenkins", attrs(model='res.company', id=1, field='name'))

debian/control

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ Depends:
4444
python-simplejson,
4545
python-suds,
4646
python-tz,
47-
python-unittest2,
4847
python-vatnumber,
4948
python-vobject,
5049
python-werkzeug,

doc/reference/javascript.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,11 +1330,6 @@ command-line (or in a CI system), but while actually running it is
13301330
pretty simple the setup of the pre-requisite parts has some
13311331
complexities.
13321332

1333-
#. Install unittest2_ in your Python environment. Both
1334-
can trivially be installed via `pip <http://pip-installer.org>`_ or
1335-
`easy_install
1336-
<http://packages.python.org/distribute/easy_install.html>`_.
1337-
13381333
#. Install PhantomJS_. It is a headless
13391334
browser which allows automating running and testing web
13401335
pages. QUnitSuite_ uses it to actually run the qunit_ test suite.
@@ -1402,8 +1397,6 @@ the OpenERP Web test suite.
14021397

14031398
.. _qunit assertions: http://api.qunitjs.com/category/assert/
14041399

1405-
.. _unittest2: http://pypi.python.org/pypi/unittest2
1406-
14071400
.. _QUnitSuite: http://pypi.python.org/pypi/QUnitSuite/
14081401

14091402
.. _PhantomJS: http://phantomjs.org/

doc/reference/testing.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Testing Modules
88
===============
99

10-
Odoo provides support for testing modules using unittest2_.
10+
Odoo provides support for testing modules using unittest.
1111

1212
To write tests, simply define a ``tests`` sub-package in your module, it will
1313
be automatically inspected for test modules. Test modules should have a name
@@ -80,5 +80,4 @@ Odoo server.
8080
As of Odoo 8, running tests outside of the install/update cycle is not
8181
supported.
8282

83-
.. _unittest2: http://pypi.python.org/pypi/unittest2
8483
.. _unittest documentation: https://docs.python.org/2/library/unittest.html

0 commit comments

Comments
 (0)