Nose不会创建测试数据库

时间:2017-12-14 12:44:29

标签: python django unit-testing nose

我正在尝试使用鼻子框架运行unittests(命令测试特定的桌面-x ),但在开始之后我得到了这个:

[14/Dec/2017 14:36:14 +0000] settings     DEBUG    DESKTOP_DB_TEST_NAME SET: hue_test
[14/Dec/2017 14:36:14 +0000] settings     DEBUG    DESKTOP_DB_TEST_USER SET: hue_test
[14/Dec/2017 14:36:14 +0000] manager      DEBUG    DefaultPluginManager load plugin flaky = flaky.flaky_nose_plugin:FlakyPlugin
[14/Dec/2017 14:36:14 +0000] manager      DEBUG    DefaultPluginManager load plugin windmill = windmill.authoring.nose_plugin:WindmillNosePlugin
nosetests desktop -x --cover-package=about,beeswax,filebrowser,hbase,help,impala,jobbrowser,jobsub,metastore,oozie,pig,proxy,query_history,rdbms,schema,search,security,spark,sqoop,useradmin,zookeeper,indexer,metadata,notebook,aws,hadoop,liboauth,liboozie,libopenid,librdbms,libsaml,libsentry,libsolr,libzookeeper --no-path-adjustment --traverse-namespace -x --verbosity=1
[14/Dec/2017 14:36:14 +0000] manager      DEBUG    DefaultPluginManager load plugin flaky = flaky.flaky_nose_plugin:FlakyPlugin
[14/Dec/2017 14:36:14 +0000] manager      DEBUG    DefaultPluginManager load plugin windmill = windmill.authoring.nose_plugin:WindmillNosePlugin
Creating test database for alias 'default'...

Traceback (most recent call last):
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/bin/hue", line 9, in <module>
    load_entry_point('desktop==3.12.0', 'console_scripts', 'hue')()
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/desktop/core/src/desktop/manage_entry.py", line 59, in entry
    execute_from_command_line(sys.argv)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/desktop/core/src/desktop/management/commands/test.py", line 108, in run_from_argv
    ret = test_runner.run_tests(nose_args)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/desktop/core/src/desktop/lib/test_runners.py", line 102, in run_tests
    result = self.run_suite(nose_argv)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/django_nose-1.3-py2.7.egg/django_nose/runner.py", line 165, in run_suite
    addplugins=plugins_to_add)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
    self.runTests()

   ...  I skipped part of traceback...   


  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/apps/useradmin/src/useradmin/models.py", line 244, in get_default_user_group
    return _get_user_group(useradmin.conf.DEFAULT_USER_GROUP.get(), is_add_permission, **kwargs)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/bdemydov/Projects/roku/roku-hue-3-12/hue-3.12.0/build/env/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.ProgrammingError: (1146, "Table 'hue_test.useradmin_huepermission' doesn't exist")

Process finished with exit code 1

在我的数据库中,当我运行“USE hue_tests;”时和“SHOW表;”我明白了:

+--------------------------------+
| Tables_in_hue_test             |
+--------------------------------+
| auth_group                     |
| auth_group_permissions         |
| auth_permission                |
| auth_user                      |
| auth_user_groups               |
| auth_user_user_permissions     |
| axes_accessattempt             |
| axes_accesslog                 |
| django_admin_log               |
| django_content_type            |
| django_openid_auth_association |
| django_openid_auth_nonce       |
| django_openid_auth_useropenid  |
| django_session                 |
| django_site                    |
| south_migrationhistory         |
+--------------------------------+

我做错了什么?我的hue_test用户(测试数据库)拥有所有权限。

0 个答案:

没有答案