... uld bypass an upstream access control based on URL paths. バグ修正 Fixed a regression in Django 3.2 that caused a crash of setUpTestData() with BinaryField on PostgreSQL, which is memoryview -backed ( #33333 ). ... ... d when using the db_column name of a ForeignKey field with primary_key=True ( #12768 ). Prevented an exception in TestCase.setUpTestData() from leaking the transaction ( #25176 ). Fixed has_changed() method in contrib.postgres.forms.HStoreField ( #25215 , #25 ... ... 対するディスクアクセスを避けるための便利な手段です。すべてのデータはメモリ内にとどまり、テスト実行の後に破棄されます。 Using setUpTestData to create test data Moving common test data to TestCase.setUpTestData() will reduce the number of times your tests need to ... create the data. Using TestCase.setUpTestData() will create test data once per class. While TestCase.setUp() will create the test data once per test. ... ... 最後に、deferrable なデータベース制約をチェックします。 さらに、以下のような追加メソッドを提供します。 classmethod TestCase. setUpTestData () [ソース] 上述のクラスレベルの atomic ブロックは、全体の TestCase に対して一度、クラスレベルでの初期データの作成を可能に ... を使うのに比べて高速なテストとなります。 例: from django.test import TestCase class MyTests ( TestCase ): @classmethod def setUpTestData ( cls ): # Set up data for the whole TestCase cls . foo = Foo . objects . create ( bar = "Test" ) ... def test1 ( self ): ... ... テストがトランザクションサポートのないデータベース (たとえば MyISAM エンジンの MySQL) で実行される場合、各テストの前に setUpTestData() が呼ばれ、高速化のメリットはなくなります。 Objects assigned to class attributes in setUpTestData() must support creating ... ... Cached template loaders are now correctly reloaded in development. テスト Objects assigned to class attributes in TestCase.setUpTestData() are now isolated for each test method. Such objects are now required to support creating deep copies with copy.deepcopy( ... 3.2 その他 Assigning objects which don't support creating deep copies with copy.deepcopy() to class attributes in TestCase.setUpTestData() is deprecated. Using a boolean value in BaseCommand.requires_system_checks is deprecated. Use '__all__' instead of True ... ... upport for assigning objects which don't support creating deep copies with copy.deepcopy() to class attributes in TestCase.setUpTestData() is removed. Support for using a boolean value in BaseCommand.requires_system_checks is removed. The whitelist argument a ... ... 、 Django 3.2 リリースノート を参照してください。 copy.deepcopy() を使用して深いコピーを作成できないオブジェクトを TestCase.setUpTestData() のクラス属性に割り当てる機能のサポートは削除されます。 BaseCommand.requires_system_checks は真偽値をサポートしなくなりま ... ... ts are now run within two nested atomic() blocks: one for the whole class and one for each test. The class method TestCase.setUpTestData() adds the ability to set up test data at the class level. Using this technique can speed up the tests as compared to usin ... 2026年10月08日