mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-08 22:13:13 +08:00
remove get_imported_module_from_file
This commit is contained in:
@@ -3,20 +3,16 @@
|
|||||||
import copy
|
import copy
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import imp
|
|
||||||
import importlib
|
|
||||||
import io
|
import io
|
||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import types
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from httprunner import exceptions, logger, validator
|
from httprunner import exceptions, logger
|
||||||
from httprunner.compat import OrderedDict, basestring, is_py2, is_py3
|
from httprunner.compat import OrderedDict, basestring, is_py2
|
||||||
from requests.structures import CaseInsensitiveDict
|
|
||||||
|
|
||||||
SECRET_KEY = "DebugTalk"
|
SECRET_KEY = "DebugTalk"
|
||||||
|
|
||||||
@@ -147,19 +143,6 @@ def deep_update_dict(origin_dict, override_dict):
|
|||||||
|
|
||||||
return origin_dict
|
return origin_dict
|
||||||
|
|
||||||
def get_imported_module_from_file(file_path):
|
|
||||||
""" DEPRECATED: import module from python file path and return imported module
|
|
||||||
"""
|
|
||||||
if is_py3:
|
|
||||||
imported_module = importlib.machinery.SourceFileLoader(
|
|
||||||
'module_name', file_path).load_module()
|
|
||||||
elif is_py2:
|
|
||||||
imported_module = imp.load_source('module_name', file_path)
|
|
||||||
else:
|
|
||||||
raise RuntimeError("Neither Python 3 nor Python 2.")
|
|
||||||
|
|
||||||
return imported_module
|
|
||||||
|
|
||||||
def lower_dict_keys(origin_dict):
|
def lower_dict_keys(origin_dict):
|
||||||
""" convert keys in dict to lower case
|
""" convert keys in dict to lower case
|
||||||
e.g.
|
e.g.
|
||||||
|
|||||||
@@ -155,18 +155,6 @@ class TestUtils(ApiServerUnittest):
|
|||||||
{'a': 2, 'b': {'c': 33, 'd': 4, 'e': 5}, 'f': 6, 'g': 7, 'h': 123}
|
{'a': 2, 'b': {'c': 33, 'd': 4, 'e': 5}, 'f': 6, 'g': 7, 'h': 123}
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_imported_module_from_file(self):
|
|
||||||
imported_module = utils.get_imported_module_from_file("tests/debugtalk.py")
|
|
||||||
self.assertIn("gen_md5", dir(imported_module))
|
|
||||||
|
|
||||||
module_mapping = loader.load_python_module(imported_module)
|
|
||||||
functions_dict = module_mapping["functions"]
|
|
||||||
self.assertIn("gen_md5", functions_dict)
|
|
||||||
self.assertNotIn("urllib", functions_dict)
|
|
||||||
|
|
||||||
with self.assertRaises(exceptions.FileNotFoundError):
|
|
||||||
utils.get_imported_module_from_file("tests/debugtalk2.py")
|
|
||||||
|
|
||||||
def test_handle_config_key_case(self):
|
def test_handle_config_key_case(self):
|
||||||
origin_dict = {
|
origin_dict = {
|
||||||
"Name": "test",
|
"Name": "test",
|
||||||
|
|||||||
Reference in New Issue
Block a user