From: Jeremy Kerr Date: Mon, 28 Aug 2017 11:39:17 +0000 (+0800) Subject: tests: Run FuzzTest within a transaction X-Git-Tag: v2.0.1~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ddef10cfdd3e7c51d005a50f46bad0561e74662b;p=thirdparty%2Fpatchwork.git tests: Run FuzzTest within a transaction Currently, the FuzzTests fail for me with: /backends/base/base.py", line 428, in validate_no_broken_transaction "An error occurred in the current transaction. You can't " TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block. - because the SQL inserts can fail, during an active transaction (the first failure I see is attempting to insert \0 chars in codec-null.mbox); this causes the setup for the next test case to fail. Instead, run each test in its own transaction. Signed-off-by: Jeremy Kerr Reviewed-by: Stephen Finucane (cherry picked from commit e505f1fd26224fc7dcadf43146bc1408a470fe15) --- diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 583dfcc4..c21040ee 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -26,6 +26,7 @@ import os import unittest from django.test import TestCase +from django.test import TransactionTestCase from django.utils import six from patchwork.models import Comment @@ -865,7 +866,7 @@ class SubjectTest(TestCase): self.assertEqual(parse_version('Hello, world (V6)', []), 6) -class FuzzTest(TestCase): +class FuzzTest(TransactionTestCase): """Test fuzzed patches.""" def setUp(self): create_project(listid='patchwork.ozlabs.org')