mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
use httprunner/cli.py as debugging entrances
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
## Development
|
## 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
|
```bash
|
||||||
$ python setup.py install
|
$ python setup.py install
|
||||||
$ python main-hrun -h
|
$ python httprunner/cli.py hrun -h
|
||||||
$ python main-locust -h
|
$ python httprunner/cli.py locust -h
|
||||||
```
|
```
|
||||||
|
|||||||
+14
-6
@@ -5,15 +5,14 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
from collections import OrderedDict
|
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 __version__ as pyu_version
|
||||||
from pyunitreport import HTMLTestRunner
|
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):
|
def run_suite_path(path, mapping=None, runner=None):
|
||||||
""" run suite with YAML/JSON file path
|
""" 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)
|
locusts.run_locusts_on_cpu_cores(sys.argv, cpu_cores_num_value)
|
||||||
else:
|
else:
|
||||||
locusts.main()
|
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 requests
|
||||||
import urllib3
|
import urllib3
|
||||||
|
from httprunner import logger
|
||||||
|
from httprunner.exception import ParamsError
|
||||||
from requests import Request, Response
|
from requests import Request, Response
|
||||||
from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
|
from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
|
||||||
RequestException)
|
RequestException)
|
||||||
|
|
||||||
from . import logger
|
|
||||||
from .exception import ParamsError
|
|
||||||
|
|
||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
absolute_http_url_regexp = re.compile(r"^https?://", re.I)
|
absolute_http_url_regexp = re.compile(r"^https?://", re.I)
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import multiprocessing
|
|||||||
import os
|
import os
|
||||||
import sys
|
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 locust.main import main
|
||||||
from .testcase import load_test_file
|
|
||||||
|
|
||||||
|
|
||||||
def parse_locustfile(file_path):
|
def parse_locustfile(file_path):
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import re
|
import re
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from httprunner import exception, logger, testcase, utils
|
||||||
from requests.structures import CaseInsensitiveDict
|
from requests.structures import CaseInsensitiveDict
|
||||||
|
|
||||||
from . import exception, logger, testcase, utils
|
|
||||||
|
|
||||||
text_extractor_regexp_compile = re.compile(r".*\(.*\).*")
|
text_extractor_regexp_compile = re.compile(r".*\(.*\).*")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from unittest.case import SkipTest
|
from unittest.case import SkipTest
|
||||||
|
|
||||||
from . import exception, logger, response, testcase, utils
|
from httprunner import exception, logger, response, testcase, utils
|
||||||
from .client import HttpSession
|
from httprunner.client import HttpSession
|
||||||
from .context import Context
|
from httprunner.context import Context
|
||||||
|
|
||||||
|
|
||||||
class Runner(object):
|
class Runner(object):
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from . import exception, logger, runner, testcase, utils
|
from httprunner import exception, logger, runner, testcase, utils
|
||||||
|
|
||||||
|
|
||||||
class ApiTestCase(unittest.TestCase):
|
class ApiTestCase(unittest.TestCase):
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import re
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from httprunner import exception, logger, utils
|
||||||
from . import exception, logger, utils
|
|
||||||
|
|
||||||
variable_regexp = r"\$([\w_]+)"
|
variable_regexp = r"\$([\w_]+)"
|
||||||
function_regexp = r"\$\{([\w_]+\([\$\w_ =,]*\))\}"
|
function_regexp = r"\$\{([\w_]+\([\$\w_ =,]*\))\}"
|
||||||
|
|||||||
+1
-2
@@ -9,10 +9,9 @@ import string
|
|||||||
import types
|
import types
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from httprunner import exception, logger
|
||||||
from requests.structures import CaseInsensitiveDict
|
from requests.structures import CaseInsensitiveDict
|
||||||
|
|
||||||
from . import exception, logger
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
string_type = basestring
|
string_type = basestring
|
||||||
long_type = long
|
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