Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #167 #168

Merged
merged 2 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions haf/asserthelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def assert_that(real, expect, **kwargs):
result = True
for temp in real.keys():
result = result and AssertHelper.assert_that(real.get(temp), expect.get(temp))
for temp in expect.keys():
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here must check the real == expect, double check

result = result and AssertHelper.assert_that(real.get(temp), expect.get(temp))
return result
elif isinstance(real, list) and isinstance(expect, list):
result = True
Expand Down
11 changes: 11 additions & 0 deletions haf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
SIGNAL_BUS_END = 25
SIGNAL_LOGGER_END = 26

# SIGNAL GROUP
SIGNAL_GROUP = {
SIGNAL_START: "signal start",
SIGNAL_STOP: "signal stop",
SIGNAL_CASE_END: "signal case end",
SIGNAL_RESULT_END: "signal result end",
SIGNAL_RECORD_END: "signal record end",
SIGNAL_BUS_END: "signal bus end",
SIGNAL_LOGGER_END: "signal logger end"
}

# api method [get, post, put, delete]
CASE_HTTP_API_METHOD_GET = 30
CASE_HTTP_API_METHOD_POST = 31
Expand Down
4 changes: 2 additions & 2 deletions haf/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,16 @@ def wait_end_signal(self, args):
if not args.console:
if not system_signal.empty():
self.signal = system_signal.get()
logger.info(f"program signal {self.signal}")
signal = self.signal.signal if isinstance(self.signal, Signal) else None
logger.info(f"program signal {SIGNAL_GROUP.get(signal) if signal in [x for x in range(20, 30)] else None}")
# check the end signal from recorder to main
if signal == SIGNAL_RECORD_END or signal == SIGNAL_STOP:
if not args.local_logger:
while True:
if not system_signal.empty():
signal_logger = system_signal.get()
logger.info(f"program signal {signal_logger}")
signal_logger = signal_logger.signal if isinstance(signal_logger, Signal) else None
logger.info(f"program signal {SIGNAL_GROUP.get(signal_logger) if signal_logger in [x for x in range(20, 30)] else None}")
# check the logger signal from logger to main
if signal_logger == SIGNAL_LOGGER_END:
logger.info("main -- stop")
Expand Down
30 changes: 20 additions & 10 deletions haf/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,35 +305,43 @@ def check_case_run_here(self, case):
:param case:
:return:
'''
logger.debug(f"Base Runner check case run here {case.dependent}", __name__)
logger.debug(f"check_case_run_here Base Runner check case run here {case.dependent}", __name__)
check_case_run_here_result = False
if not case.dependent or len(case.dependent) == 0:
return True
check_case_run_here_result = True
return check_case_run_here_result
elif isinstance(case.dependent, list) and case.dependent==['None']:
return True
check_case_run_here_result = True
return check_case_run_here_result
try:
for dependence in case.dependent:
if dependence not in self.bench.cases.keys():
return False
check_case_run_here_result = False
return check_case_run_here_result
if isinstance(case, HttpApiCase):
self.get_dependent_var(case)
return True
check_case_run_here_result = True
return check_case_run_here_result
except Exception:
return False
check_case_run_here_result = False
return check_case_run_here_result

def check_case_filter(self, case):
'''
check case is in the filter
:param case:
:return:
'''
logger.debug(f"case <{case.ids.name}> check in [{self.bench.args.filter_case}]", __name__)
filter_cases = self.bench.args.filter_case
check_case_filter_result = False
if filter_cases is None or filter_cases=='None':
return True
check_case_filter_result = True
elif isinstance(filter_cases, list):
return case.ids.name in filter_cases
check_case_filter_result = case.ids.name in filter_cases
else:
return True
check_case_filter_result = True
logger.debug(f"check_case_filter case <{case.ids.name}> check in [{self.bench.args.filter_case}], result is {check_case_filter_result}", __name__)
return check_case_filter_result

def check_case_run(self, case): # if skip, return False
if self.check_case_filter(case):
Expand Down Expand Up @@ -473,9 +481,11 @@ async def run(self, case:PyCase):
result.on_case_begin()

if not self.check_case_run_here(case) :
logger.debug(f"PyRunner check_case_run_here : Dependent not found ! get False", __name__)
result.on_case_end()
return [CASE_CAN_NOT_RUN_HERE, result]
if not self.check_case_run(case): # not False is skip
logger.debug(f"PyRunner check_case_run False", __name__)
result.case = case
result.on_case_end()
result.result = RESULT_SKIP
Expand Down