diff --git a/httprunner/__about__.py b/httprunner/__about__.py deleted file mode 100644 index 795de67a..00000000 --- a/httprunner/__about__.py +++ /dev/null @@ -1,9 +0,0 @@ -__title__ = 'HttpRunner' -__description__ = 'One-stop solution for HTTP(S) testing.' -__url__ = 'https://github.com/HttpRunner/HttpRunner' -__version__ = '2.2.4' -__author__ = 'debugtalk' -__author_email__ = 'mail@debugtalk.com' -__license__ = 'Apache-2.0' -__copyright__ = 'Copyright 2017 debugtalk' -__cake__ = u'\u2728 \U0001f370 \u2728' \ No newline at end of file diff --git a/httprunner/__init__.py b/httprunner/__init__.py index e69de29b..1516a0e9 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -0,0 +1,9 @@ +import configparser +import json + +cf_parser = configparser.ConfigParser(allow_no_value=True) +cf_parser.read("pyproject.toml") +__version__ = json.loads(cf_parser["tool.poetry"]["version"]) +__description__ = json.loads(cf_parser["tool.poetry"]["description"]) + +__all__ = ["__version__", "__description__"] diff --git a/httprunner/cli.py b/httprunner/cli.py index 2bafe0c8..677f7be8 100644 --- a/httprunner/cli.py +++ b/httprunner/cli.py @@ -5,7 +5,7 @@ def main_hrun(): """ import argparse from httprunner import logger - from httprunner.__about__ import __description__, __version__ + from httprunner import __description__, __version__ from httprunner.api import HttpRunner from httprunner.compat import is_py2 from httprunner.validator import validate_json_file diff --git a/httprunner/report.py b/httprunner/report.py index 19d1581a..989e2b3b 100644 --- a/httprunner/report.py +++ b/httprunner/report.py @@ -10,8 +10,7 @@ from collections import Iterable from datetime import datetime import requests -from httprunner import loader, logger -from httprunner.__about__ import __version__ +from httprunner import __version__, loader, logger from httprunner.compat import basestring, bytes, json, numeric_types from jinja2 import Template, escape diff --git a/pyproject.toml b/pyproject.toml index 450f7eed..f5178551 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "2.2.4" description = "One-stop solution for HTTP(S) testing." license = "Apache-2.0" readme = "README.md" -authors = ["debugtalk "] +authors = ["debugtalk "] homepage = "https://github.com/HttpRunner/HttpRunner" repository = "https://github.com/HttpRunner/HttpRunner"