Skip to content

Wrapped tests now make use of Django's atomic transactions#2

Open
zenoamaro wants to merge 1 commit intoneubloc:masterfrom
zenoamaro:feature/django16
Open

Wrapped tests now make use of Django's atomic transactions#2
zenoamaro wants to merge 1 commit intoneubloc:masterfrom
zenoamaro:feature/django16

Conversation

@zenoamaro
Copy link
Copy Markdown

This patch updates ColorDjangoTestSuiteRunner.wrap_tests in order to use
of Django's atomic transactions, as well as making them available to the
TestCase itself.

These are the parts that needed to be backported from Django:

    # django/test/testcases.py:848
    # https://github.com/django/django/blob/master/django/test/testcases.py#L848
    def _fixture_setup(self):
        # ...
        self.atomics = {}
        for db_name in self._databases_names():
            self.atomics[db_name] = transaction.atomic(using=db_name)
            self.atomics[db_name].__enter__()
        # ...
    # django/test/testcases.py:877
    # https://github.com/django/django/blob/master/django/test/testcases.py#L877
    def _fixture_teardown(self):
        # ...
        for db_name in reversed(self._databases_names()):
            # ...
            self.atomics[db_name].__exit__(None, None, None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant