1515import os
1616
1717import pytest
18-
1918from testing_support .fixtures import (
2019 collector_agent_registration_fixture ,
21- collector_available_fixture , # noqa: F401 # autouse fixture, must be importable in this module
20+ collector_available_fixture , # autouse fixture, must be importable in this module
2221)
2322from testing_support .validators .validate_transaction_metrics import validate_transaction_metrics
2423
25-
2624_default_settings = {
2725 "package_reporting.enabled" : False , # Turn off package reporting for testing as it causes slow downs.
2826 "transaction_tracer.explain_threshold" : 0.0 ,
3735 app_name = "Python Agent Test (framework_wagtail)" , default_settings = _default_settings , scope = "module"
3836)
3937
38+
4039@pytest .fixture (autouse = True )
4140def database ():
4241 os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , "settings" )
@@ -51,9 +50,8 @@ def database():
5150 # ``Page``) and a default ``Site``. Replace that root with a ``HomePage``
5251 # and hang a ``RoutablePage`` beneath it so that "/" and "/routable/"
5352 # resolve to real, renderable pages served by the dummy_app page types.
54- from wagtail .models import Page , Site
55-
5653 from dummy_app .models import HomePage , RoutablePage
54+ from wagtail .models import Page , Site
5755
5856 if not HomePage .objects .exists ():
5957 site = Site .objects .get (is_default_site = True )
@@ -64,6 +62,7 @@ def database():
6462 default_home .delete ()
6563 home .add_child (instance = RoutablePage (title = "Routable" , slug = "routable" ))
6664
65+
6766def target_application ():
6867 from _target_application import _target_application
6968
@@ -78,7 +77,7 @@ def target_application():
7877 ("Python/WSGI/Response" , 1 ),
7978 ("Python/WSGI/Finalize" , 1 ),
8079 ("Function/wagtail.views:serve" , 1 ),
81- ]
80+ ],
8281)
8382def test_home ():
8483 test_application = target_application ()
@@ -93,7 +92,7 @@ def test_home():
9392 ("Python/WSGI/Response" , 1 ),
9493 ("Python/WSGI/Finalize" , 1 ),
9594 ("Function/wagtail.views:serve" , 1 ),
96- ]
95+ ],
9796)
9897def test_routable ():
9998 test_application = target_application ()
@@ -108,7 +107,7 @@ def test_routable():
108107 ("Python/WSGI/Response" , 1 ),
109108 ("Python/WSGI/Finalize" , 1 ),
110109 ("Function/wagtail.views:serve" , 1 ),
111- ]
110+ ],
112111)
113112def test_routable_routable ():
114113 test_application = target_application ()
0 commit comments