From abf567b0cfa81b868d6803225fc33144fb3a6268 Mon Sep 17 00:00:00 2001 From: Nikita Fedorov Date: Tue, 6 Dec 2022 00:04:33 +0300 Subject: [PATCH] [qase-python-commons] Fixed an issue with host --- qase-pytest/setup.cfg | 2 +- qase-python-commons/setup.py | 2 +- qase-python-commons/src/qaseio/commons/testops.py | 2 +- qase-robotframework/README.md | 2 +- qase-robotframework/requirements.txt | 2 +- qase-robotframework/setup.cfg | 2 +- .../src/qaseio/robotframework/Listener/qase_listener.py | 9 +++++++-- .../src/qaseio/robotframework/Listener/types.py | 2 ++ qase-robotframework/tests/test_listener.py | 7 +------ 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/qase-pytest/setup.cfg b/qase-pytest/setup.cfg index b8aa4792..6e2f8ae5 100644 --- a/qase-pytest/setup.cfg +++ b/qase-pytest/setup.cfg @@ -29,7 +29,7 @@ package_dir = setup_requires = pyscaffold>=3.2a0,<3.3a0 # Add here dependencies of your project (semicolon/line-separated), e.g. install_requires = - qase-python-commons>=1.0.1 + qase-python-commons>=1.0.2 pytest>=5.2.0 filelock>=3.0 python_requires = >=3.7 diff --git a/qase-python-commons/setup.py b/qase-python-commons/setup.py index 16c9fcd2..90e8e0e7 100644 --- a/qase-python-commons/setup.py +++ b/qase-python-commons/setup.py @@ -11,7 +11,7 @@ from pkg_resources import VersionConflict, require from setuptools import setup -VERSION = "1.0.1" +VERSION = "1.0.2" try: require("setuptools>=38.3") diff --git a/qase-python-commons/src/qaseio/commons/testops.py b/qase-python-commons/src/qaseio/commons/testops.py index 064b09ee..beee1c1f 100644 --- a/qase-python-commons/src/qaseio/commons/testops.py +++ b/qase-python-commons/src/qaseio/commons/testops.py @@ -46,7 +46,7 @@ def __init__(self, configuration = Configuration() configuration.api_key['TokenAuth'] = api_token - configuration.host = f'http://api.{host}/v1' + configuration.host = f'https://api.{host}/v1' self.client = ApiClient(configuration) diff --git a/qase-robotframework/README.md b/qase-robotframework/README.md index b89f1bdd..a6f1fb6a 100644 --- a/qase-robotframework/README.md +++ b/qase-robotframework/README.md @@ -72,7 +72,7 @@ ENV variables: - `QASE_TESTOPS_HOST` - Define a host for Qase TestOps. Default: `qase.io` ### Usage: ``` -QASE_API_TOKEN= QASE_PROJECT=PRJCODE robot --listener qaseio.robotframework.Listener keyword_driven.robot data_driven.robot +QASE_API_TOKEN= QASE_PROJECT=PRJCODE robot --listener qaseio.robotframework.QaseListener keyword_driven.robot data_driven.robot ``` Moving variables to `tox.ini`, example configuration: ```ini diff --git a/qase-robotframework/requirements.txt b/qase-robotframework/requirements.txt index 13e22bad..8f9e7061 100644 --- a/qase-robotframework/requirements.txt +++ b/qase-robotframework/requirements.txt @@ -1 +1 @@ -qase-python-commons=1.0.1 \ No newline at end of file +qase-python-commons=1.0.2 \ No newline at end of file diff --git a/qase-robotframework/setup.cfg b/qase-robotframework/setup.cfg index 42fa5833..447b3ce6 100644 --- a/qase-robotframework/setup.cfg +++ b/qase-robotframework/setup.cfg @@ -27,7 +27,7 @@ package_dir = setup_requires = pyscaffold>=3.2a0,<3.3a0 # Add here dependencies of your project (semicolon/line-separated), e.g. install_requires = - qase-python-commons>=1.0.0 + qase-python-commons>=1.0.2 python_requires = >=3.7 [options.packages.find] diff --git a/qase-robotframework/src/qaseio/robotframework/Listener/qase_listener.py b/qase-robotframework/src/qaseio/robotframework/Listener/qase_listener.py index f797e570..c7cc0091 100644 --- a/qase-robotframework/src/qaseio/robotframework/Listener/qase_listener.py +++ b/qase-robotframework/src/qaseio/robotframework/Listener/qase_listener.py @@ -11,6 +11,7 @@ from qaseio.commons import QaseTestOps from qaseio.commons import QaseUtils +from qaseio.commons import QaseReport from .types import Envs, STATUSES from .models import * @@ -54,14 +55,16 @@ def __init__(self): host=self._get_param(Envs.TESTOPS_HOST, 'qase.io'), environment=self._get_param(Envs.ENVIRONMENT, None) ) + else: + self.reporter = QaseReport( + report_path=self._get_param(Envs.REPORT_PATH, 'build/qase-report'), + ) self.result = {} self.steps = {} self.step_uuid = None self.suite = {} - self.reporter.start_run() - self.debug = self._get_param(Envs.DEBUG) and self._get_param(Envs.DEBUG).lower() in ['true', '1'] if self.debug: logger.setLevel(logging.DEBUG) @@ -72,6 +75,8 @@ def __init__(self): ch.setFormatter(formatter) logger.addHandler(ch) + self.reporter.start_run() + def _get_param(self, param: Envs, default=None): param: str = param.value return os.environ.get( diff --git a/qase-robotframework/src/qaseio/robotframework/Listener/types.py b/qase-robotframework/src/qaseio/robotframework/Listener/types.py index c5f99b75..dc3fcd08 100644 --- a/qase-robotframework/src/qaseio/robotframework/Listener/types.py +++ b/qase-robotframework/src/qaseio/robotframework/Listener/types.py @@ -14,6 +14,8 @@ class Envs(Enum): TESTOPS_RUN_TITLE = "QASE_TESTOPS_RUN_TITLE" TESTOPS_COMPLETE_RUN = "QASE_TESTOPS_COMPLETE_RUN" + REPORT_PATH = "QASE_REPORT_PATH" + STATUSES = { "PASS": "passed", "FAIL": "failed", diff --git a/qase-robotframework/tests/test_listener.py b/qase-robotframework/tests/test_listener.py index 55251473..2a7ae861 100644 --- a/qase-robotframework/tests/test_listener.py +++ b/qase-robotframework/tests/test_listener.py @@ -15,9 +15,4 @@ def setup_env(): def test_init_listener(setup_env): - QaseListener() - - -def test_init_listener_error(): - with pytest.raises(ValueError): - QaseListener() + QaseListener() \ No newline at end of file