Almad / django-sane-testing

Django integration with nose, Selenium and more
https://github.com/Almad/django-sane-testing
Other
59 stars 8 forks source link

Parallel test threads don't work in testproject #22

Open andrejtokarcik opened 13 years ago

andrejtokarcik commented 13 years ago

In particular, when running tests, TestFixturesLoadedProperly.test_available_in_another_thread triggers an error.

I'm running Django 1.2.5, current DST (this repo's HEAD) and have tried nose 0.11.3 as well as 1.0, without any difference.

Complete output:

`--> ./manage.py test
....E.............SSSSSSSSS...........................
======================================================================
ERROR: testproject.test.test_database.TestFixturesLoadedProperly.test_available_in_another_thread
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 186, in runTest
    self.test(*self.arg)
  File "/home/andrej/tmp/django-sane-testing/testproject/../testproject/test/test_database.py", line 70, in test_available_in_another_thread
    self.assertEquals(u'OKidoki', self.urlopen('%sassert_two_example_models/' % get_live_server_path()).read())
  File "/home/andrej/tmp/django-sane-testing/testproject/../djangosanetesting/cases.py", line 203, in urlopen
    raise extract_django_traceback(http_error=err)
HTTPError: HTTP Error 500: Environment:

Request Method: GET
Request URL: http://localhost:8000/assert_two_example_models/
Django Version: 1.2.5
Python Version: 2.7.0
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'testapp']
Installed Middleware:
('django.middleware.common.CommonMiddleware',)

Traceback:
File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/home/andrej/tmp/django-sane-testing/testproject/../testproject/views.py" in assert_two_example_models
  11.     assert 2 == len(ExampleModel.objects.all())
File "/usr/lib/python2.7/site-packages/django/db/models/query.py" in __len__
  80.                 self._result_cache = list(self.iterator())
File "/usr/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  271.         for row in compiler.results_iter():
File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  677.         for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  732.         cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  15.             return self.cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
  200.             return Database.Cursor.execute(self, query, params)

Exception Type: DatabaseError at /assert_two_example_models/
Exception Value: no such table: testapp_examplemodel

----------------------------------------------------------------------
Ran 54 tests in 1.947s

FAILED (SKIP=9, errors=1)