mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 10:29:39 +08:00
use httprunner/cli.py as debugging entrances
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
## Development
|
||||
|
||||
To develop or debug `HttpRunner`, you can install relevant requirements and use `main-hrun.py` or `main-locust.py` as entrances.
|
||||
To develop or debug `HttpRunner`, you can install relevant requirements and use `httprunner/cli.py` as entrances.
|
||||
|
||||
```bash
|
||||
$ python setup.py install
|
||||
$ python main-hrun -h
|
||||
$ python main-locust -h
|
||||
$ python httprunner/cli.py hrun -h
|
||||
$ python httprunner/cli.py locust -h
|
||||
```
|
||||
|
||||
@@ -5,15 +5,14 @@ import sys
|
||||
import unittest
|
||||
from collections import OrderedDict
|
||||
|
||||
from httprunner import __version__ as hrun_version
|
||||
from httprunner import logger
|
||||
from httprunner.exception import TestcaseNotFound
|
||||
from httprunner.task import Result, TaskSuite
|
||||
from httprunner.utils import create_scaffold, print_output, string_type
|
||||
from pyunitreport import __version__ as pyu_version
|
||||
from pyunitreport import HTMLTestRunner
|
||||
|
||||
from . import __version__ as hrun_version
|
||||
from . import logger
|
||||
from .exception import TestcaseNotFound
|
||||
from .task import Result, TaskSuite
|
||||
from .utils import create_scaffold, print_output, string_type
|
||||
|
||||
|
||||
def run_suite_path(path, mapping=None, runner=None):
|
||||
""" run suite with YAML/JSON file path
|
||||
@@ -144,3 +143,12 @@ def main_locust():
|
||||
locusts.run_locusts_on_cpu_cores(sys.argv, cpu_cores_num_value)
|
||||
else:
|
||||
locusts.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cmd = sys.argv.pop(1)
|
||||
|
||||
if cmd == "hrun":
|
||||
main_hrun()
|
||||
elif cmd == "locust":
|
||||
main_locust()
|
||||
|
||||
@@ -4,13 +4,12 @@ import time
|
||||
|
||||
import requests
|
||||
import urllib3
|
||||
from httprunner import logger
|
||||
from httprunner.exception import ParamsError
|
||||
from requests import Request, Response
|
||||
from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
|
||||
RequestException)
|
||||
|
||||
from . import logger
|
||||
from .exception import ParamsError
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
absolute_http_url_regexp = re.compile(r"^https?://", re.I)
|
||||
|
||||
@@ -3,10 +3,10 @@ import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
|
||||
from locust.main import main
|
||||
from httprunner.logger import color_print
|
||||
from httprunner.testcase import load_test_file
|
||||
|
||||
from .logger import color_print
|
||||
from .testcase import load_test_file
|
||||
from locust.main import main
|
||||
|
||||
|
||||
def parse_locustfile(file_path):
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import re
|
||||
from collections import OrderedDict
|
||||
|
||||
from httprunner import exception, logger, testcase, utils
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
from . import exception, logger, testcase, utils
|
||||
|
||||
text_extractor_regexp_compile = re.compile(r".*\(.*\).*")
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from unittest.case import SkipTest
|
||||
|
||||
from . import exception, logger, response, testcase, utils
|
||||
from .client import HttpSession
|
||||
from .context import Context
|
||||
from httprunner import exception, logger, response, testcase, utils
|
||||
from httprunner.client import HttpSession
|
||||
from httprunner.context import Context
|
||||
|
||||
|
||||
class Runner(object):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
|
||||
from . import exception, logger, runner, testcase, utils
|
||||
from httprunner import exception, logger, runner, testcase, utils
|
||||
|
||||
|
||||
class ApiTestCase(unittest.TestCase):
|
||||
|
||||
@@ -8,8 +8,7 @@ import re
|
||||
from collections import OrderedDict
|
||||
|
||||
import yaml
|
||||
|
||||
from . import exception, logger, utils
|
||||
from httprunner import exception, logger, utils
|
||||
|
||||
variable_regexp = r"\$([\w_]+)"
|
||||
function_regexp = r"\$\{([\w_]+\([\$\w_ =,]*\))\}"
|
||||
|
||||
@@ -9,10 +9,9 @@ import string
|
||||
import types
|
||||
from collections import OrderedDict
|
||||
|
||||
from httprunner import exception, logger
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
from . import exception, logger
|
||||
|
||||
try:
|
||||
string_type = basestring
|
||||
long_type = long
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
""" used for debugging
|
||||
"""
|
||||
|
||||
from httprunner.cli import main_hrun
|
||||
main_hrun()
|
||||
@@ -1,5 +0,0 @@
|
||||
""" used for debugging
|
||||
"""
|
||||
|
||||
from httprunner.cli import main_locust
|
||||
main_locust()
|
||||
Reference in New Issue
Block a user