Commit bd7c9cf6 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

[test] drop CubicWebConfigurationWithLegacyCubesTC

This is used to test legacy cube import which is planned for removal
in cubicweb 3.27, so drop the code.
parent ec089debcd45
../libpython/cubicweb_comment
\ No newline at end of file
../libpython/cubicweb_email/
\ No newline at end of file
../libpython/cubicweb_file
\ No newline at end of file
../libpython/cubicweb_forge
\ No newline at end of file
../libpython/cubicweb_mycube
\ No newline at end of file
......@@ -187,72 +187,6 @@ class CubicWebConfigurationTC(BaseTestCase):
self.assertNotIn('cubes.mycube.ccplugin', sys.modules, sorted(sys.modules))
self.assertIn('cubicweb_mycube.ccplugin', sys.modules, sorted(sys.modules))
class CubicWebConfigurationWithLegacyCubesTC(CubicWebConfigurationTC):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp(self):
self.custom_cubes_dir = self.datapath('legacy_cubes')
cleanup_sys_modules([self.custom_cubes_dir, ApptestConfiguration.CUBES_DIR])
super(CubicWebConfigurationWithLegacyCubesTC, self).setUp()
self.config.__class__.CUBES_PATH = [self.custom_cubes_dir]
self.config.adjust_sys_path()
def tearDown(self):
ApptestConfiguration.CUBES_PATH = []
def test_available_cubes(self):
expected_cubes = [
'card',
'comment',
'email',
'file',
'forge',
'cubicweb_localperms',
'mycube',
'tag',
]
self.assertEqual(self.config.available_cubes(), expected_cubes)
def test_reorder_cubes_recommends(self):
from cubes.comment import __pkginfo__ as comment_pkginfo
self._test_reorder_cubes_recommends(comment_pkginfo)
def test_cubes_path(self):
# make sure we don't import the email cube, but the stdlib email package
import email
self.assertNotEqual(dirname(email.__file__), self.config.CUBES_DIR)
self.config.__class__.CUBES_PATH = [self.custom_cubes_dir]
self.assertEqual(self.config.cubes_search_path(),
[self.custom_cubes_dir, self.config.CUBES_DIR])
self.config.__class__.CUBES_PATH = [self.custom_cubes_dir,
self.config.CUBES_DIR, 'unexistant']
# filter out unexistant and duplicates
self.assertEqual(self.config.cubes_search_path(),
[self.custom_cubes_dir,
self.config.CUBES_DIR])
self.assertIn('mycube', self.config.available_cubes())
# test cubes python path
self.config.adjust_sys_path()
import cubes
self.assertEqual(cubes.__path__, self.config.cubes_search_path())
# this import should succeed once path is adjusted
from cubes import mycube
self.assertEqual(mycube.__path__, [join(self.custom_cubes_dir, 'mycube')])
# file cube should be overriden by the one found in data/cubes
sys.modules.pop('cubes.file')
if hasattr(cubes, 'file'):
del cubes.file
from cubes import file
self.assertEqual(file.__path__, [join(self.custom_cubes_dir, 'file')])
def test_config_value_from_environment_str(self):
self.assertIsNone(self.config['base-url'])
os.environ['CW_BASE_URL'] = 'https://www.cubicweb.org'
......@@ -280,11 +214,6 @@ class CubicWebConfigurationWithLegacyCubesTC(CubicWebConfigurationTC):
finally:
del os.environ['CW_ALLOW_EMAIL_LOGIN']
def test_ccplugin_modname(self):
self.config.load_cwctl_plugins()
self.assertIn('cubes.mycube.ccplugin', sys.modules, sorted(sys.modules))
self.assertNotIn('cubicweb_mycube.ccplugin', sys.modules, sorted(sys.modules))
class ModnamesTC(unittest.TestCase):
......
......@@ -43,7 +43,7 @@ commands =
{envpython} -m check_manifest {toxinidir} \
# ignore symlinks that are not recognized by check-manifest, see
# https://github.com/mgedmin/check-manifest/issues/69
--ignore cubicweb/devtools/test/data/cubes/i18ntestcube*,cubicweb/test/data/legacy_cubes*,cubicweb/server/test/data-migractions/cubicweb_*,cubicweb/server/test/data-migractions/migratedapp/cubicweb_*
--ignore cubicweb/devtools/test/data/cubes/i18ntestcube*,cubicweb/server/test/data-migractions/cubicweb_*,cubicweb/server/test/data-migractions/migratedapp/cubicweb_*
[pytest]
python_files = *test_*.py
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment