graphite-project / graphite-web

A highly scalable real-time graphing system
http://graphite.readthedocs.org/
Apache License 2.0
5.89k stars 1.26k forks source link

trouble running functions_test.py #482

Closed esc closed 10 years ago

esc commented 10 years ago
zsh» nosetests graphite/render/functions_test.py
E
======================================================================
ERROR: Failure: ImproperlyConfigured (settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/data/home/vhaenel/git-working/graphite-web/webapp/graphite/render/functions_test.py", line 16, in <module>
    from graphite.render.datalib import TimeSeries
  File "/data/home/vhaenel/git-working/graphite-web/webapp/graphite/render/datalib.py", line 17, in <module>
    from graphite.storage import STORE
  File "/data/home/vhaenel/git-working/graphite-web/webapp/graphite/storage.py", line 4, in <module>
    from graphite.util import is_local_interface, is_pattern
  File "/data/home/vhaenel/git-working/graphite-web/webapp/graphite/util.py", line 118, in <module>
    defaultUser = User.objects.get(username='default')
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/manager.py", line 143, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/query.py", line 398, in get
    num = len(clone)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/query.py", line 106, in __len__
    self._result_cache = list(self.iterator())
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/query.py", line 317, in iterator
    for row in compiler.results_iter():
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 775, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 836, in execute_sql
    sql, params = self.as_sql()
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 74, in as_sql
    out_cols = self.get_columns(with_col_aliases)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 212, in get_columns
    col_aliases)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 299, in get_default_columns
    r = '%s.%s' % (qn(alias), qn2(field.column))
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 52, in quote_name_unless_alias
    r = self.connection.ops.quote_name(name)
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
esc commented 10 years ago

Or am I doing it wrong?

esc commented 10 years ago

I also tried using the instructions from:

https://docs.djangoproject.com/en/dev/topics/testing/overview/

zsh» python manage.py test
Could not import graphite.local_settings, using defaults!
/data/home/vhaenel/git-working/graphite-web/webapp/graphite/settings.py:217: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
Creating test database for alias 'default'...
...............................................................F.................................................................F................s...........................................................................................................................x...................................................................................................................................
======================================================================
FAIL: testLoginRequired (django.contrib.auth.tests.decorators.LoginRequiredTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/contrib/auth/tests/decorators.py", line 37, in testLoginRequired
    self.assertTrue(login_url in response['Location'])
AssertionError: False is not true

======================================================================
FAIL: test_unknown_user (django.contrib.auth.tests.remote_user.RemoteUserNoCreateTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/home/vhaenel/virtualenv/graphite/local/lib/python2.7/site-packages/django/contrib/auth/tests/remote_user.py", line 145, in test_unknown_user
    self.assertTrue(response.context['user'].is_anonymous())
AssertionError: False is not true

----------------------------------------------------------------------
Ran 402 tests in 4.264s

FAILED (failures=2, skipped=1, expected failures=1)
Destroying test database for alias 'default'...

And this looks fine at first sight, but when I add the following patch to check if the tests do actually run:

diff --git i/webapp/graphite/render/functions_test.py w/webapp/graphite/render/functions_test.py
index f57bda1371..8a054e271b 100644
--- i/webapp/graphite/render/functions_test.py
+++ w/webapp/graphite/render/functions_test.py
@@ -19,6 +19,9 @@ import graphite.render.functions as functions

 class FunctionsTest(unittest.TestCase):

+    def testFaile(self):
+        self.assertFalse(True)
+
     def testHighestMax(self):
         config = [ 20, 50, 30, 40 ]
         seriesList = [range(max_val) for max_val in config]

The failure is not reported, inidicating this does not actually run the tests...

esc commented 10 years ago

I'll close this one myself now, since by now I have figured out how to run them.

FYI:

$ cd webapp
$ python manage.py test --settings=tests.settings
[...]