changeset fcb96ee188e5 in modules/google_maps:default
details:
https://hg.tryton.org/modules/google_maps?cmd=changeset&node=fcb96ee188e5
description:
Replace test setuptools command by unittest discover
issue9215
review389851002
diffstat:
setup.py | 2 -
tests/__init__.py | 7 ------
tests/test_google_maps.py | 52 -----------------------------------------------
tests/test_module.py | 46 +++++++++++++++++++++++++++++++++++++++++
tox.ini | 2 +-
5 files changed, 47 insertions(+), 62 deletions(-)
diffs (141 lines):
diff -r a383c1810be9 -r fcb96ee188e5 setup.py
--- a/setup.py Sun Apr 10 19:11:38 2022 +0200
+++ b/setup.py Sat Apr 16 18:30:17 2022 +0200
@@ -142,6 +142,4 @@
[trytond.modules]
google_maps = trytond.modules.google_maps
""",
- test_suite='tests',
- test_loader='trytond.test_loader:Loader',
)
diff -r a383c1810be9 -r fcb96ee188e5 tests/__init__.py
--- a/tests/__init__.py Sun Apr 10 19:11:38 2022 +0200
+++ b/tests/__init__.py Sat Apr 16 18:30:17 2022 +0200
@@ -1,9 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
-
-try:
- from trytond.modules.google_maps.tests.test_google_maps import suite
-except ImportError:
- from .test_google_maps import suite
-
-__all__ = ['suite']
diff -r a383c1810be9 -r fcb96ee188e5 tests/test_google_maps.py
--- a/tests/test_google_maps.py Sun Apr 10 19:11:38 2022 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-# This file is part of Tryton. The COPYRIGHT file at the top level of
-# this repository contains the full copyright notices and license terms.
-import unittest
-
-import trytond.tests.test_tryton
-from trytond.pool import Pool
-from trytond.tests.test_tryton import ModuleTestCase, with_transaction
-
-
-class GoogleMapsTestCase(ModuleTestCase):
- 'Test GoogleMaps module'
- module = 'google_maps'
-
- @with_transaction()
- def test_google_maps_url(self):
- "Test Google Maps URL"
- pool = Pool()
- Address = pool.get('party.address')
- Party = pool.get('party.party')
- party = Party()
- party.save()
- address = Address()
- address.party = party
- address.street = "300 Cliff Street"
- address.postal_code = "18503"
- address.city = "Scranton"
- address.save()
-
- self.assertEqual(
- address.on_change_with_google_maps_url(),
- 'http://maps.google.com/maps?hl=en&'
- 'q=300%20Cliff%20Street%2018503%20Scranton')
-
- address = Address()
- address.party = party
- address.street = "Dépôt Street"
- address.postal_code = "18503"
- address.city = "Scranton"
- address.save()
-
- self.assertEqual(
- address.on_change_with_google_maps_url(),
- 'http://maps.google.com/maps?hl=en&'
- 'q=D%C3%A9p%C3%B4t%20Street%2018503%20Scranton')
-
-
-def suite():
- suite = trytond.tests.test_tryton.suite()
- suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
- GoogleMapsTestCase))
- return suite
diff -r a383c1810be9 -r fcb96ee188e5 tests/test_module.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_module.py Sat Apr 16 18:30:17 2022 +0200
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+
+from trytond.pool import Pool
+from trytond.tests.test_tryton import ModuleTestCase, with_transaction
+
+
+class GoogleMapsTestCase(ModuleTestCase):
+ 'Test GoogleMaps module'
+ module = 'google_maps'
+
+ @with_transaction()
+ def test_google_maps_url(self):
+ "Test Google Maps URL"
+ pool = Pool()
+ Address = pool.get('party.address')
+ Party = pool.get('party.party')
+ party = Party()
+ party.save()
+ address = Address()
+ address.party = party
+ address.street = "300 Cliff Street"
+ address.postal_code = "18503"
+ address.city = "Scranton"
+ address.save()
+
+ self.assertEqual(
+ address.on_change_with_google_maps_url(),
+ 'http://maps.google.com/maps?hl=en&'
+ 'q=300%20Cliff%20Street%2018503%20Scranton')
+
+ address = Address()
+ address.party = party
+ address.street = "Dépôt Street"
+ address.postal_code = "18503"
+ address.city = "Scranton"
+ address.save()
+
+ self.assertEqual(
+ address.on_change_with_google_maps_url(),
+ 'http://maps.google.com/maps?hl=en&'
+ 'q=D%C3%A9p%C3%B4t%20Street%2018503%20Scranton')
+
+
+del ModuleTestCase
diff -r a383c1810be9 -r fcb96ee188e5 tox.ini
--- a/tox.ini Sun Apr 10 19:11:38 2022 +0200
+++ b/tox.ini Sat Apr 16 18:30:17 2022 +0200
@@ -3,7 +3,7 @@
[testenv]
commands =
- coverage run --include=.*/google_maps/* setup.py test
+ coverage run --include=.*/google_maps/* -m unittest discover -s tests
coverage report --include=.*/google_maps/* --omit=*/tests/*
deps =
coverage