[devtools/test] drop legacy cube i18n tests
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Thu, 28 Mar 2019 10:07:02 +0100
changeset 12546 465ee7fb16e3
parent 12545 be36811f0d08
child 12547 a11119d327e4
[devtools/test] drop legacy cube i18n tests test_i18ncube_legacy_layout() is droped and make others tests uses a new style cube "cubicweb_i18ntestcube", so it doesn't depends on legacy cube machinery.
cubicweb/devtools/test/data/cubes/__init__.py
cubicweb/devtools/test/data/cubes/i18ntestcube
cubicweb/devtools/test/unittest_i18n.py
--- a/cubicweb/devtools/test/data/cubes/i18ntestcube	Thu Mar 28 10:04:23 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../libpython/cubicweb_i18ntestcube/
\ No newline at end of file
--- a/cubicweb/devtools/test/unittest_i18n.py	Thu Mar 28 10:04:23 2019 +0100
+++ b/cubicweb/devtools/test/unittest_i18n.py	Thu Mar 28 10:07:02 2019 +0100
@@ -58,7 +58,7 @@
     return msgs
 
 
-TESTCUBE_DIR = osp.join(DATADIR, 'cubes', 'i18ntestcube')
+TESTCUBE_DIR = osp.join(DATADIR, 'libpython', 'cubicweb_i18ntestcube')
 
 
 class cubePotGeneratorTC(TestCase):
@@ -74,17 +74,6 @@
         cubedir = osp.join(DATADIR, 'libpython', 'cubicweb_i18ntestcube')
         self._check(cubedir, env)
 
-    def test_i18ncube_legacy_layout(self):
-        env = os.environ.copy()
-        env['CW_CUBES_PATH'] = osp.join(DATADIR, 'cubes')
-        if 'PYTHONPATH' in env:
-            env['PYTHONPATH'] += os.pathsep
-        else:
-            env['PYTHONPATH'] = ''
-        env['PYTHONPATH'] += DATADIR
-        cubedir = osp.join(DATADIR, 'cubes', 'i18ntestcube')
-        self._check(cubedir, env)
-
     def _check(self, cubedir, env):
         cmd = [sys.executable, '-m', 'cubicweb', 'i18ncube', 'i18ntestcube']
         proc = Popen(cmd, env=env, stdout=PIPE, stderr=STDOUT)
@@ -137,19 +126,14 @@
     @patch('pkg_resources.load_entry_point', return_value=FakeMessageExtractor)
     def test_cube_custom_extractor(self, mock_load_entry_point):
         distname = 'cubicweb_i18ntestcube'  # same for new and legacy layout
-        for cubedir in [
-            osp.join(DATADIR, 'libpython', 'cubicweb_i18ntestcube'),
-            # Legacy cubes.
-            osp.join(DATADIR, 'cubes', 'i18ntestcube'),
-        ]:
-            with self.subTest(cubedir=cubedir):
-                with capture_stdout() as stream:
-                    devctl.update_cube_catalogs(cubedir)
-                self.assertIn(u'no message catalog for cube i18ntestcube',
-                              stream.read())
-                mock_load_entry_point.assert_called_once_with(
-                    distname, 'cubicweb.i18ncube', 'i18ntestcube')
-                mock_load_entry_point.reset_mock()
+        cubedir = osp.join(DATADIR, 'libpython', 'cubicweb_i18ntestcube')
+        with capture_stdout() as stream:
+            devctl.update_cube_catalogs(cubedir)
+        self.assertIn(u'no message catalog for cube i18ntestcube',
+                      stream.read())
+        mock_load_entry_point.assert_called_once_with(
+            distname, 'cubicweb.i18ncube', 'i18ntestcube')
+        mock_load_entry_point.reset_mock()
 
 
 if __name__ == '__main__':