File: compat.py

package info (click to toggle)
pytest-django 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 480 kB
  • sloc: python: 2,853; makefile: 148
file content (15 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# This file cannot be imported from until Django sets up
try:
    # Django 1.11
    from django.test.utils import setup_databases, teardown_databases  # noqa: F401
except ImportError:
    # In Django prior to 1.11, teardown_databases is only available as a method on DiscoverRunner
    from django.test.runner import (  # noqa: F401
        setup_databases,
        DiscoverRunner as _DiscoverRunner,
    )

    def teardown_databases(db_cfg, verbosity):
        _DiscoverRunner(verbosity=verbosity, interactive=False).teardown_databases(
            db_cfg
        )