... o.git django-repo $ cd django-repo/tests $ python -m pip install -e .. $ python -m pip install -r requirements/py3.txt $ ./runtests.py ...\> git clone https://github.com/YourGitHubName/django.git django-repo ...\> cd django-repo\tests ...\> py -m pip ins ... tall -e .. ...\> py -m pip install -r requirements\py3.txt ...\> runtests.py Installing the requirements will likely require some operating system packages that your computer doesn't have installe ... ndency locally. For example, if installing pylibmc fails, comment out its line in requirements/py3.txt and continue with ./runtests.py . Tests that require pylibmc will be skipped automatically. See Running all the tests for details on installing the opt ... ... PostGIS インストーラには template_postgis というタイトルのテンプレート空間データベースが含まれています。 GeoDjangoのテスト runtests.py を使用して Djangoテストスイートを実行する 際に GeoDjango テストを実行するには、設定ファイル内のすべてのデータベースが 空 ... .db.backends.postgis" , "NAME" : "other" , "USER" : "geodjango" , }, } SECRET_KEY = "django_tests_secret_key" 上記の設定が runtests.py と同じディレクトリにある postgis.py ファイルにあるとすると、コマンドを実行するときに、すべての Django と GeoDjango のテ ... ストが実行されます: $ ./runtests.py --settings = postgis GeoDjango のテストスイートだけを実行するには、 gis_tests を指定します: $ ./runtests.py --settings ... ... トを調べるか、発生したエラーメッセージをウェブで検索してください。 これでテストスイートを実行する準備が整いました: / $ ./runtests.py ...\> runtests.py さあ、座ってリラックスしてください。Django のテストスイート全体には何千ものテストがあり、コンピュータ ... のテストを実行して、どうなるか見てみましょう。 cd でDjangoの tests/ ディレクトリへと移動してから実行してください。 / $ ./runtests.py shortcuts ...\> runtests.py shortcuts テストが正しく実行されれば追加したテストメソッドに対して、こちらのエラーとともに1 ... ードが正しく機能しているかどうかを確認できます。もう一度、Django の tests/ ディレクトリに移動して以下を実行します: / $ ./runtests.py shortcuts ...\> runtests.py shortcuts テストはすべて成功するはずです。失敗した場合は、正しいファイルに対して正しく関数を ... ... pip install pre-commit ...\> pre-commit install See Pre-commit checks for further details. Run the tests: / $ ./tests/runtests.py ...\> tests\runtests.py See Running the unit tests for more information. While tests will all pass in CI, they may not ... ... ート . Backwards-incompatible changes in 1.1.2 Test runner exit status code The exit status code of the test runners ( tests/runtests.py and python manage.py test ) no longer represents the number of failed tests, since a failure of 256 or more tests resul ... ... ner , added in this release. In addition, the GeoDjango test suite is now included when running the Django test suite with runtests.py and using spatial database backends . ... ... run standalone. For our example, we'll pretend we created tests/migrations/test_regression.py , which can be run with: $ ./runtests.py migrations.test_regression Next, we mark the current point in history as being "bad" since the test fails: $ git bisect ... hly Y steps ) ... Now we're ready for the fun part: using git bisect run to automate the rest of the process: $ git bisect run tests/runtests.py migrations.test_regression You should see git bisect use a binary search to automatically checkout revisions ... ... mary key value may not be predictable or known. Fast failure for tests Both the test subcommand of django-admin.py and the runtests.py script used to run Django's own test suite now support a --failfast option. When specified, this option causes the test ... o handle or filter out the _state attribute. Test runner exit status code The exit status code of the test runners ( tests/runtests.py and python manage.py test ) no longer represents the number of failed tests, because a failure of 256 or more tests res ... ... e good test coverage, these warnings are converted to errors when running the test suite with warnings enabled: python -Wa runtests.py . Thus, when adding a RemovedInDjangoXXXXWarning you need to eliminate or silence any warnings generated when running t ... ... 思うかもしれません。 一般的な慣習は、アプリケーションコードの隣に tests ディレクトリを置き、以下のような構成にすることです: runtests.py polls/ __init__.py models.py ... tests/ __init__.py models.py test_settings.py tests.py いくつかのファイルの中身を見てみ ... ましょう: runtests.py #!/usr/bin/env python import os import sys import django from django.conf import settings from django.test.utils import ... 2026年10月08日