Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions qase-python-commons/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# qase-python-commons@5.0.7

## What's new

Unified HostData model to align field names across all Qase reporter languages:

- Renamed `python` -> `language` and `pip` -> `packageManager` in host data dictionary.
- Normalized `system` field to lowercase (`windows`, `darwin`, `linux`).
- Removed legacy `QaseUtils.get_host_data()` in favor of `get_host_info()` from `host_data.py`.
- X-Platform headers retain language-specific keys (`python=`, `pip=`).

# qase-python-commons@5.0.6

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-python-commons/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "qase-python-commons"
version = "5.0.6"
version = "5.0.7"
description = "A library for Qase TestOps and Qase Report"
readme = "README.md"
authors = [{name = "Qase Team", email = "support@qase.io"}]
Expand Down
6 changes: 3 additions & 3 deletions qase-python-commons/src/qase/commons/client/api_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ def _add_client_headers(self):
if arch:
x_platform_parts.append(f"arch={arch}")

python_version = host_data.get('python', '')
python_version = host_data.get('language', '')
if python_version:
x_platform_parts.append(f"python={python_version}")
pip_version = host_data.get('pip', '')

pip_version = host_data.get('packageManager', '')
if pip_version:
x_platform_parts.append(f"pip={pip_version}")

Expand Down
3 changes: 2 additions & 1 deletion qase-python-commons/src/qase/commons/reporters/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ..models import Result, Run, Attachment
from ..models.step import Step, StepType, StepTextData
from .. import QaseUtils, Logger
from ..util.host_data import get_host_info
from ..models.config.connection import Format
from ..models.config.qaseconfig import QaseConfig

Expand Down Expand Up @@ -175,7 +176,7 @@ def _compile_report(self):
result = self._read_object(source)
run.add_result(result)

run.add_host_data(QaseUtils.get_host_data())
run.add_host_data(get_host_info(None, None))

self._store_object(run, self.report_path, "run")

Expand Down
8 changes: 4 additions & 4 deletions qase-python-commons/src/qase/commons/util/host_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def get_host_info(framework: Optional[str], reporter_name: Optional[str]) -> Hos
"release": remove_version_prefix(platform.release()),
"version": remove_version_prefix(get_detailed_os_info()),
"arch": platform.machine(),
"python": python_version,
"pip": pip_version,
"language": python_version,
"packageManager": pip_version,
"framework": framework_version,
"reporter": reporter_version,
"commons": commons_version,
Expand All @@ -137,8 +137,8 @@ def get_host_info(framework: Optional[str], reporter_name: Optional[str]) -> Hos
"release": remove_version_prefix(platform.release()),
"version": "",
"arch": platform.machine(),
"python": "",
"pip": "",
"language": "",
"packageManager": "",
"framework": "",
"reporter": "",
"commons": "",
Expand Down
21 changes: 0 additions & 21 deletions qase-python-commons/src/qase/commons/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import os
import platform
import threading
import sys
from typing import Union, List
try:
import pip
pip_version = pip.__version__
except ModuleNotFoundError:
pip_version = "unknown"
import string
import uuid
import time
Expand Down Expand Up @@ -128,21 +122,6 @@ def parse_bool(value) -> bool:
def uuid() -> str:
return str(uuid.uuid4())

@staticmethod
def get_host_data() -> dict:
try:
return {
"system": platform.uname().system,
"node": platform.uname().node,
"release": platform.uname().release,
"version": platform.uname().version,
"machine": platform.uname().machine,
'python': '.'.join(map(str, sys.version_info)),
'pip': pip_version
}
except Exception as e:
return {}

@staticmethod
def get_filename(path) -> str:
return os.path.basename(path)
Expand Down
13 changes: 0 additions & 13 deletions qase-python-commons/tests/tests_qase_commons/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from mock import Mock
import os
import threading
import sys
import pip
import time

from qase.commons.utils import QaseUtils
Expand Down Expand Up @@ -36,17 +34,6 @@ def test_get_thread_name():
thread_name = QaseUtils.get_thread_name()
assert thread_name == f"{os.getpid()}-{threading.current_thread().name}"

def test_get_host_data():
host_data = QaseUtils.get_host_data()

assert host_data['system'] == os.uname().sysname
assert host_data['node'] == os.uname().nodename
assert host_data['release'] == os.uname().release
assert host_data['version'] == os.uname().version
assert host_data['machine'] == os.uname().machine
assert host_data['python'] == '.'.join(map(str, sys.version_info))
assert host_data['pip'] == pip.__version__

def test_get_filename():
path = '/path/to/file.txt'
filename = QaseUtils.get_filename(path)
Expand Down
Loading