Debian Codegraph @

hypothesis-python/tests/django/manage.py

raw
1 # This file is part of Hypothesis, which may be found at
2 # https://github.com/HypothesisWorks/hypothesis/
3 #
4 # Copyright the Hypothesis Authors.
5 # Individual contributors are listed in AUTHORS.rst and the git log.
6 #
7 # This Source Code Form is subject to the terms of the Mozilla Public License,
8 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
9 # obtain one at https://mozilla.org/MPL/2.0/.
10
11 import os
12 import sys
13 import warnings
14
15 from hypothesis import HealthCheck, settings
16
17 from tests.common.setup import run
18
19 if __name__ == "__main__":
20 run()
21
22 settings.register_profile(
23 "default", settings(suppress_health_check=[HealthCheck.too_slow])
24 )
25
26 settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default"))
27
28 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.django.toys.settings")
29
30 # This triggers a deprecation warning on some older versions of Django
31 # because of its use of the imp module.
32 with warnings.catch_warnings():
33 warnings.simplefilter("ignore", category=DeprecationWarning)
34 from django.core.management import execute_from_command_line
35
36 try:
37 from django.utils.deprecation import RemovedInDjango50Warning
38 except ImportError:
39 RemovedInDjango50Warning = ()
40
41 try:
42 from django.utils.deprecation import RemovedInDjango60Warning
43 except ImportError:
44 RemovedInDjango60Warning = ()
45
46 with warnings.catch_warnings():
47 warnings.simplefilter("ignore", category=RemovedInDjango50Warning)
48 warnings.simplefilter("ignore", category=RemovedInDjango60Warning)
49 execute_from_command_line(sys.argv)