Skip to content

Commit e709b0e

Browse files
committed
shift things around a little
1 parent 08ed46e commit e709b0e

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

tests/test_mig_wsgi-bin_migwsgi.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
_TEST_CONF_SYMLINK = os.path.join(MIG_BASE, "envhelp/output/testconfs")
5151

5252

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+
5362
def _assert_local_config():
5463
try:
5564
link_stat = os.lstat(_TEST_CONF_SYMLINK)
@@ -74,31 +83,11 @@ def _assert_local_config_global_values(config):
7483
return config_global_values
7584

7685

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-
8586
def _is_return_value(return_value):
8687
defined_return_values = returnvalues.__dict__.values()
8788
return return_value in defined_return_values
8889

8990

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-
10291
def create_instrumented_format_output(arranged):
10392
def _instrumented_format_output(
10493
configuration,
@@ -150,6 +139,18 @@ def _instrumented_format_output(
150139
return _instrumented_format_output
151140

152141

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+
153154
def create_wsgi_environ(config_file, wsgi_variables):
154155
environ = {}
155156
environ['wsgi.input'] = ()

0 commit comments

Comments
 (0)