50
50
_TEST_CONF_SYMLINK = os .path .join (MIG_BASE , "envhelp/output/testconfs" )
51
51
52
52
53
+ # workaround for migwsgi being placed witin a non-module directory
54
+ def _import_migwsgi ():
55
+ sys .path .append (os .path .join (MIG_BASE , 'mig/wsgi-bin' ))
56
+ migwsgi = importlib .import_module ('migwsgi' )
57
+ sys .path .pop (- 1 )
58
+ return migwsgi
59
+ migwsgi = _import_migwsgi ()
60
+
61
+
53
62
def _assert_local_config ():
54
63
try :
55
64
link_stat = os .lstat (_TEST_CONF_SYMLINK )
@@ -74,31 +83,11 @@ def _assert_local_config_global_values(config):
74
83
return config_global_values
75
84
76
85
77
- def _import_migwsgi ():
78
- sys .path .append (os .path .join (MIG_BASE , 'mig/wsgi-bin' ))
79
- migwsgi = importlib .import_module ('migwsgi' )
80
- sys .path .pop (- 1 )
81
- return migwsgi
82
- migwsgi = _import_migwsgi ()
83
-
84
-
85
86
def _is_return_value (return_value ):
86
87
defined_return_values = returnvalues .__dict__ .values ()
87
88
return return_value in defined_return_values
88
89
89
90
90
- def create_instrumented_retrieve_handler (output_objects = None , return_value = None ):
91
- if not output_objects :
92
- output_objects = []
93
-
94
- assert isinstance (output_objects , list )
95
- assert _is_return_value (return_value ), "return value must be present in returnvalues"
96
-
97
- def _instrumented_retrieve_handler (* args ):
98
- return [], return_value
99
- return _instrumented_retrieve_handler
100
-
101
-
102
91
def create_instrumented_format_output (arranged ):
103
92
def _instrumented_format_output (
104
93
configuration ,
@@ -150,6 +139,18 @@ def _instrumented_format_output(
150
139
return _instrumented_format_output
151
140
152
141
142
+ def create_instrumented_retrieve_handler (output_objects = None , return_value = None ):
143
+ if not output_objects :
144
+ output_objects = []
145
+
146
+ assert isinstance (output_objects , list )
147
+ assert _is_return_value (return_value ), "return value must be present in returnvalues"
148
+
149
+ def _instrumented_retrieve_handler (* args ):
150
+ return [], return_value
151
+ return _instrumented_retrieve_handler
152
+
153
+
153
154
def create_wsgi_environ (config_file , wsgi_variables ):
154
155
environ = {}
155
156
environ ['wsgi.input' ] = ()
0 commit comments