Test failures ("no transaction is active") with Ghost.py
Question: I have a Django project that does some calculations in Javascript.

I am using [Ghost.py](http://jeanphix.me/Ghost.py/) to try and incorporate
efficient tests of the Javascript calculations into the Django test suite:

    
    
    from ghost.ext.django.test import GhostTestCase
    
    class CalculationsTest(GhostTestCase):
        def setUp(self):
            page, resources = self.ghost.open('http://localhost:8081/_test/')
            self.assertEqual(page.http_status, 200)
    
        def test_frobnicate(self):
            result, e_resources = self.ghost.evaluate('''
                frobnicate(test_data, "argument");
            ''')
            self.assertEqual(result, 1.204)
    

(where `frobnicate()` is a Javascript function on the test page.

This works very well if I run one test at a time.

If, however, I run `django-admin.py test`, I get

    
    
    Traceback (most recent call last):
      ...
        result = self.run_suite(suite)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/runner.py", line 113, in run_suite
        ).run(suite)
      File "/usr/lib64/python2.7/unittest/runner.py", line 151, in run
        test(result)
      File "/usr/lib64/python2.7/unittest/suite.py", line 70, in __call__
        return self.run(*args, **kwds)
      File "/usr/lib64/python2.7/unittest/suite.py", line 108, in run
        test(result)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/testcases.py", line 184, in __call__
        super(SimpleTestCase, self).__call__(result)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/ghost/test.py", line 53, in __call__
        self._post_teardown()
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/testcases.py", line 796, in _post_teardown
        self._fixture_teardown()
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/testcases.py", line 817, in _fixture_teardown
        inhibit_post_syncdb=self.available_apps is not None)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
        return klass.execute(*args, **defaults)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
        output = self.handle(*args, **options)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
        return self.handle_noargs(**options)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 81, in handle_noargs
        self.emit_post_syncdb(verbosity, interactive, db)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 101, in emit_post_syncdb
        emit_post_sync_signal(set(all_models), verbosity, interactive, database)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/sql.py", line 216, in emit_post_sync_signal
        interactive=interactive, db=db)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
        response = receiver(signal=self, sender=sender, **named)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 82, in create_permissions
        ctype = ContentType.objects.db_manager(db).get_for_model(klass)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 47, in get_for_model
        defaults = {'name': smart_text(opts.verbose_name_raw)},
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/models/manager.py", line 154, in get_or_create
        return self.get_queryset().get_or_create(**kwargs)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/models/query.py", line 388, in get_or_create
        six.reraise(*exc_info)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/models/query.py", line 380, in get_or_create
        obj.save(force_insert=True, using=self.db)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/transaction.py", line 305, in __exit__
        connection.commit()
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/backends/__init__.py", line 168, in commit
        self._commit()
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/backends/__init__.py", line 136, in _commit
        return self.connection.commit()
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
        six.reraise(dj_exc_type, dj_exc_value, traceback)
      File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/backends/__init__.py", line 136, in _commit
        return self.connection.commit()
    django.db.utils.OperationalError: cannot commit - no transaction is active
    

(running with `django-nose` gives weirder, inconsistent results)

Any clues on how to prevent this issue, which is currently standing in the way
of CI?


Answer: I haven't used Ghost myself but for a similar test I had to use
[TransactionTestCase](https://docs.djangoproject.com/en/1.8/topics/testing/tools/#django.test.TransactionTestCase)
to get a similar test working. Could you try changing GhostTestCase and see if
that's working?

