Hi!

I am trying to run unitests for one of my application.

Here is the code of the test (it doesn't do anything yet)

import os
import re

#import unittest
from django.core import management
from django.test import TestCase
from django.test.client import Client
from django.core import mail
from django.test.utils import setup_test_environment
from django.contrib.auth.models import User
from django.db import connection

from goserver.models import ActiveList
#
class GoserverTestCase(TestCase):
    #fixtures = ['dat.json']

    def setUp(self):
        pass

    def test_active_list_works(self):
        c = Client()
        c.get('/login/')
        self.assertEquals(True, True)



When I run those tests I get an error:

Installing index for goserver.Game model
.
----------------------------------------------------------------------
Ran 1 test in 3.497s

OK
Destroying test database...

----------------------------------------------------------------------
 Unit Test Code Coverage Results
----------------------------------------------------------------------
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File
"/opt/local/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/__init__.py",
line 340, in execute_manager
    utility.execute()
  File
"/opt/local/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/__init__.py",
line 295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/opt/local/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/base.py",
line 192, in run_from_argv
    self.execute(*args, **options.__dict__)
  File
"/opt/local/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/base.py",
line 219, in execute
    output = self.handle(*args, **options)
  File
"/opt/local/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/management/commands/test.py",
line 33, in handle
    failures = test_runner(test_labels, verbosity=verbosity,
interactive=interactive)
  File
"/opt/local/lib/python2.5/site-packages/django_test_coverage-0.1-py2.5.egg/django-test-coverage/runner.py",
line 58, in run_tests
    modules.extend(_package_modules(*pkg))
  File
"/opt/local/lib/python2.5/site-packages/django_test_coverage-0.1-py2.5.egg/django-test-coverage/runner.py",
line 92, in _package_modules
    modules.append(__import__(impstr + '.' + name, {}, {}, ['']))
  File "/Users/oleg/jin/goclub/trunk/jin/goserver/admin.py", line 11, in
<module>
    admin.site.register(ActiveList, ActiveListAdmin)
  File
"/opt/local/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/sites.py",
line 64, in register
    raise AlreadyRegistered('The model %s is already registered' %
model.__name__)
django.contrib.admin.sites.AlreadyRegistered: The model ActiveList is
already registered
silver:jin oleg$

>From the coverage module I guess....

Also, when I remove this line c.get('/login/')

So test looks like this

class GoserverTestCase(TestCase):
    #fixtures = ['dat.json']

    def setUp(self):
        pass

    def test_active_list_works(self):
        c = Client()

        self.assertEquals(True, True)

There is no error at all

Could you please explain the problem?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to