httprunner/HttpRunnerManager

运行用例报TypeError

KeleDeng opened this issue · 4 comments

运行用例,结果报

Exception Type: TypeError
int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'
E:\Learn\HttpRunnerManager\ApiManager\utils\common.py in timestamp_to_datetime, line 628
E:\Python36\python.exe

能提交一下复现步骤和报错场景?这样我能更快的定位问题,谢谢

应该是httprunner版本过高

'datetime.datetime'时间类型是不能被强制被强制转整形的

所以关注一下类型的问题也许能解决你的问题

场景就是点击了运行用例按钮,运行用例,结果报错,具体环境及报错如下
Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/api/run_test/

Django Version: 2.1.1
Python Version: 3.6.0
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ApiManager',
'djcelery']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "E:\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)

File "E:\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)

File "E:\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "E:\Learn\HttpRunnerManager\HttpRunnerManager\activator.py" in process
15. result = fun(request, index) if index else fun(request)

File "E:\Learn\HttpRunnerManager\ApiManager\views.py" in wrapper
39. return func(request, *args, **kwargs)

File "E:\Learn\HttpRunnerManager\ApiManager\views.py" in run_test
238. runner.summary = timestamp_to_datetime(runner.summary,type=False)

File "E:\Learn\HttpRunnerManager\ApiManager\utils\common.py" in timestamp_to_datetime
628. time_stamp = int(summary["time"]["start_at"])

Exception Type: TypeError at /api/run_test/
Exception Value: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'