Browse Source

HUE-9432 [core] Detect if chardet is installed

Ying Chen 5 years ago
parent
commit
111416a2bf
1 changed files with 8 additions and 1 deletions
  1. 8 1
      desktop/core/src/desktop/tests.py

+ 8 - 1
desktop/core/src/desktop/tests.py

@@ -43,7 +43,7 @@ from django.views.static import serve
 from django.http import HttpResponse
 from django.http import HttpResponse
 from nose.plugins.attrib import attr
 from nose.plugins.attrib import attr
 from nose.plugins.skip import SkipTest
 from nose.plugins.skip import SkipTest
-from nose.tools import assert_true, assert_false, assert_equal, assert_not_equal, assert_raises, nottest
+from nose.tools import assert_true, assert_false, assert_equal, assert_not_equal, assert_raises, nottest, raises
 
 
 from dashboard.conf import HAS_SQL_ENABLED
 from dashboard.conf import HAS_SQL_ENABLED
 from desktop.settings import DATABASES
 from desktop.settings import DATABASES
@@ -1526,6 +1526,13 @@ def test_db_migrations_mysql():
       del DATABASES[name]
       del DATABASES[name]
 
 
 
 
+@raises(ImportError)
+def test_forbidden_libs():
+  if sys.version_info[0] > 2:
+    raise SkipTest
+  import chardet # chardet license (LGPL) is not compatible and should not be bundled
+
+
 class TestGetConfigErrors():
 class TestGetConfigErrors():
 
 
   def setUp(self):
   def setUp(self):