From de412a2431bdb86f41bff155bb6fd9e10a7838bb Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 25 Oct 2019 17:06:05 +0800 Subject: [PATCH] change: rename folder, templates => static --- README.md | 2 +- httprunner/report.py | 10 ++++------ httprunner/{templates => static}/qrcode.jpg | Bin .../{templates => static}/report_template.html | 0 pyproject.toml | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) rename httprunner/{templates => static}/qrcode.jpg (100%) rename httprunner/{templates => static}/report_template.html (100%) diff --git a/README.md b/README.md index c932b118..7b5f1311 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ HttpRunner is rich documented. 关注 HttpRunner 的微信公众号,第一时间获得最新资讯。 -![](httprunner/templates/qrcode.jpg) +![](httprunner/static/qrcode.jpg) [Requests]: http://docs.python-requests.org/en/master/ [unittest]: https://docs.python.org/3/library/unittest.html diff --git a/httprunner/report.py b/httprunner/report.py index c01a9aae..34ac9c6b 100644 --- a/httprunner/report.py +++ b/httprunner/report.py @@ -1,5 +1,3 @@ -# encoding: utf-8 - import io import os import platform @@ -9,8 +7,8 @@ from base64 import b64encode from collections import Iterable from datetime import datetime -import requests from jinja2 import Template, escape +from requests.cookies import RequestsCookieJar from httprunner import __version__, logger from httprunner.compat import basestring, bytes, json, numeric_types @@ -150,7 +148,7 @@ def __stringify_request(request_data): # class instance, e.g. MultipartEncoder() value = repr(value) - elif isinstance(value, requests.cookies.RequestsCookieJar): + elif isinstance(value, RequestsCookieJar): value = value.get_dict() request_data[key] = value @@ -209,7 +207,7 @@ def __stringify_response(response_data): # class instance, e.g. MultipartEncoder() value = repr(value) - elif isinstance(value, requests.cookies.RequestsCookieJar): + elif isinstance(value, RequestsCookieJar): value = value.get_dict() response_data[key] = value @@ -283,7 +281,7 @@ def render_html_report(summary, report_template=None, report_dir=None, report_fi if not report_template: report_template = os.path.join( os.path.abspath(os.path.dirname(__file__)), - "templates", + "static", "report_template.html" ) logger.log_debug("No html report template specified, use default.") diff --git a/httprunner/templates/qrcode.jpg b/httprunner/static/qrcode.jpg similarity index 100% rename from httprunner/templates/qrcode.jpg rename to httprunner/static/qrcode.jpg diff --git a/httprunner/templates/report_template.html b/httprunner/static/report_template.html similarity index 100% rename from httprunner/templates/report_template.html rename to httprunner/static/report_template.html diff --git a/pyproject.toml b/pyproject.toml index 8280e744..06e947e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules" ] -include = ["CHANGELOG.md", "httprunner/templates/*"] +include = ["CHANGELOG.md", "httprunner/static/*"] [tool.poetry.dependencies] python = "~2.7 || ^3.5"