mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
remove get_imported_module
This commit is contained in:
@@ -147,11 +147,6 @@ def deep_update_dict(origin_dict, override_dict):
|
||||
|
||||
return origin_dict
|
||||
|
||||
def get_imported_module(module_name):
|
||||
""" import module and return imported module
|
||||
"""
|
||||
return importlib.import_module(module_name)
|
||||
|
||||
def get_imported_module_from_file(file_path):
|
||||
""" import module from python file path and return imported module
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import requests
|
||||
from httprunner import exceptions, response, utils
|
||||
from httprunner import built_in, exceptions, response, utils
|
||||
from httprunner.compat import basestring, bytes
|
||||
from tests.base import HTTPBIN_SERVER, ApiServerUnittest
|
||||
|
||||
@@ -7,8 +7,7 @@ from tests.base import HTTPBIN_SERVER, ApiServerUnittest
|
||||
class TestResponse(ApiServerUnittest):
|
||||
|
||||
def setUp(self):
|
||||
imported_module = utils.get_imported_module("httprunner.built_in")
|
||||
self.functions_mapping = utils.filter_module(imported_module, "function")
|
||||
self.functions_mapping = utils.filter_module(built_in, "function")
|
||||
|
||||
def test_parse_response_object_json(self):
|
||||
url = "http://127.0.0.1:5000/api/users"
|
||||
|
||||
@@ -99,8 +99,8 @@ class TestUtils(ApiServerUnittest):
|
||||
self.assertEqual(utils.get_uniform_comparator("count_less_than_or_equals"), "length_less_than_or_equals")
|
||||
|
||||
def current_validators(self):
|
||||
imported_module = utils.get_imported_module("httprunner.built_in")
|
||||
functions_mapping = utils.filter_module(imported_module, "function")
|
||||
from httprunner import built_in
|
||||
functions_mapping = utils.filter_module(built_in, "function")
|
||||
|
||||
functions_mapping["equals"](None, None)
|
||||
functions_mapping["equals"](1, 1)
|
||||
@@ -154,15 +154,8 @@ class TestUtils(ApiServerUnittest):
|
||||
{'a': 2, 'b': {'c': 33, 'd': 4, 'e': 5}, 'f': 6, 'g': 7, 'h': 123}
|
||||
)
|
||||
|
||||
def test_get_imported_module(self):
|
||||
imported_module = utils.get_imported_module("os")
|
||||
self.assertIn("walk", dir(imported_module))
|
||||
|
||||
def test_filter_module_functions(self):
|
||||
imported_module = utils.get_imported_module("httprunner.utils")
|
||||
self.assertIn("is_py3", dir(imported_module))
|
||||
|
||||
functions_dict = utils.filter_module(imported_module, "function")
|
||||
functions_dict = utils.filter_module(utils, "function")
|
||||
self.assertIn("filter_module", functions_dict)
|
||||
self.assertNotIn("is_py3", functions_dict)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user