Skip to content

Commit

Permalink
Merge pull request #34 from tsbxmw/dev-2.1.0
Browse files Browse the repository at this point in the history
release 2.0.5
  • Loading branch information
tsbxmw authored Dec 7, 2018
2 parents deaf779 + a8db9ff commit 54faf7a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion haf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

MAIN_VERSION = 2
SUB_VERSION = 0
FIX_VERSION = 4
FIX_VERSION = 5
VERSION_TYPE = "dev"
PLATFORM_VERSION = f"{VERSION_TYPE}-{MAIN_VERSION}.{SUB_VERSION}.{FIX_VERSION}"

Expand Down
30 changes: 25 additions & 5 deletions haf/ext/resource/report/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
{% endfor %}
</td>
<td>{{results.begin_time}}</td>
{% if results.end_time %}
<td>{{results.end_time}}</td>
{% else %}
<td>running...</td>
{% endif %}
<td>{{results.duration}}</td>
<td>{{results.passed}}</td>
<td>{{results.failed}}</td>
Expand Down Expand Up @@ -162,26 +166,42 @@
<li>url : {{case.case.request.url}}</li>
<li onclick="showElement('{{case.case.request}}')" ><a>all</a></li>
<ul id="{{case.case.request}}" style="display:none">
<li>header : {{case.case.request.header}}</li>
<li>data : {{case.case.request.data}}</li>
<li>header :
<pre>{{case.case.request.header}}</pre>
</li>
<li>data :
<pre>{{case.case.request.data}}</pre>
</li>
</ul>
</td>
<td>
{% set response=case.case.response.deserialize() %}
<li >code : {{response.get("code")}}</li>
<li onclick="showElement('{{case.case.response}}')" ><a>all</a></li>
<ul id="{{case.case.response}}" style="display:none">
<li style="hidden:none">header : {{response.get("header")}}</li>
<li style="hidden:none">body : {{response.get("body")}}</li>
<li style="hidden:none">
header :
<pre>{{response.get("header")}}</pre>
</li>
<li style="hidden:none">
body :
<pre>{{response.get("body")}}</pre>
</li>
</ul>
</td>
<td>
{% set check=case.result_check_response %}
<li onclick="showElement('{{'{}.{}.{}.{}.response_check'.format(case.case.bench_name, case.case.ids.id, case.case.ids.subid, case.case.ids.name)}}')"><a>response check</a></li>
<ul id="{{'{}.{}.{}.{}.response_check'.format(case.case.bench_name, case.case.ids.id, case.case.ids.subid, case.case.ids.name)}}" style="display:none">
<li>code check: {{case.result_check_response[0]}}</li>
<li>code check:
<pre>{{case.result_check_response[0]}}</pre>
</li>
<li><a href="file:///{{case.log_dir}}">body check: {{case.result_check_response[1]}}</a></li>
</ul>
<li onclick="showElement('{{'{}.{}.{}.{}.run_error'.format(case.case.bench_name, case.case.ids.id, case.case.ids.subid, case.case.ids.name)}}')"><a>run error</a></li>
<div id="{{'{}.{}.{}.{}.run_error'.format(case.case.bench_name, case.case.ids.id, case.case.ids.subid, case.case.ids.name)}}" style="display:none">
<pre> {{case.run_error}} </pre>
</div>
</td>
<td>
<ul>
Expand Down
1 change: 1 addition & 0 deletions haf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def main_args():
sub_run_arg_program.add_argument("--only-recorder", "-ore", type=bool, default=False, dest="only_recorder", help="""if true, only start recorder""")
sub_run_arg_program.add_argument("--config", "-c", type=str, dest="config", help="""customer config""")
sub_run_arg_program.add_argument("--api", "-api", dest="api", default=True, type=bool, help="api case or not, default is true")
sub_run_arg_program.add_argument("--debug", "-debug", dest="debug", default=False, type=bool, help="open debug or not")

args = arg_program.parse_args()
main_program = Program()
Expand Down
2 changes: 0 additions & 2 deletions haf/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import functools
import inspect
import time

from haf.case import PyCase
from haf.common.lock import Lock


Expand Down
5 changes: 4 additions & 1 deletion haf/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def _start_recorder(self, count: int=1, report_path: str=""):
recorder.start()
time.sleep(0.1)

def _init_logging_module(self, args):
logging.basicConfig(level=logging.INFO if not args.debug else logging.DEBUG, format='%(asctime)s %(levelname)s <%(process)d> [%(name)s] %(message)s')

def _init_system_logger(self, log_dir: str, bus_client:BusClient):
l = Logger(self.case_name, log_dir, bus_client)
l.start()
Expand Down Expand Up @@ -91,9 +94,9 @@ def _start_web_server(self, args):

def run(self, args):
try:
self._init_logging_module(args)
self.case_name = Utils.get_case_name()
runner_count = args.runner_count if args.runner_count else 1

self.only_bus(args)

self._start_bus(local=args.bus_server if args.bus_server else False)
Expand Down
3 changes: 2 additions & 1 deletion haf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,12 @@ def get_path(path):
def get_class_from_py(module):
built_in_list = ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
attr_list = ['AttrNoneList', 'bench_name', 'error_msg', 'expect', 'id', 'mark', 'name', 'run', 'subid', 'type']
attr_none_list = ["BaseCase", "PyCase", "HttpApiCase"]
class_list = []
for attr in dir(module):
class_attr = getattr(module, attr)
class_temp = {attr: class_attr}
if attr not in built_in_list and inspect.isclass(class_attr) and attr != "BaseCase":
if attr not in built_in_list and inspect.isclass(class_attr) and attr not in attr_none_list:
if issubclass(class_attr, BaseCase) and isinstance(class_attr(), BaseCase):
class_list.append(class_temp)
return class_list if len(class_list) > 0 else None
Expand Down

0 comments on commit 54faf7a

Please sign in to comment.