Skip to content

Commit

Permalink
Merge pull request #179 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth authored Oct 16, 2023
2 parents 9bd8dfc + 5012265 commit 87ecd45
Show file tree
Hide file tree
Showing 27 changed files with 397 additions and 359 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: tox

- name: Upload coverage to Codecov
if: matrix.python-version == 3.7 && success()
if: matrix.python-version == 3.8 && success()
uses: codecov/codecov-action@v3
with:
files: coverage.xml
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## [Unreleased]
### Added
- `RP_CLIENT_TYPE` configuration variable, by @HardNorth
- `RP_CONNECT_TIMEOUT` and `RP_READ_TIMEOUT` configuration variables, by @HardNorth
### Changed
- Client version updated on [5.5.0](https://github.com/reportportal/client-Python/releases/tag/5.5.0), by @HardNorth
### Removed
- Dependency on `six`, by @HardNorth

## [5.4.0]
### Added
- `RP_LAUNCH_UUID_PRINT` and `RP_LAUNCH_UUID_PRINT_OUTPUT` configuration variables, by @HardNorth
### Changed
- Internal item list was replaced with LifoQueue, by @HardNorth
Expand Down
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![PyPI](https://img.shields.io/pypi/v/robotframework-reportportal.svg?maxAge=259200)](https://pypi.python.org/pypi/robotframework-reportportal)
[![Python versions](https://img.shields.io/pypi/pyversions/robotframework-reportportal.svg)](https://pypi.org/project/robotframework-reportportal)
[![Build Status](https://github.com/reportportal/agent-Python-RobotFramework/actions/workflows/tests.yml/badge.svg)](https://github.com/reportportal/agent-Python-RobotFramework/actions/workflows/tests.yml)
[![codecov.io](https://codecov.io/gh/reportportal/agent-Python-RobotFramework/branch/master/graph/badge.svg)](https://codecov.io/gh/reportportal/agent-Python-RobotFramework)
[![codecov.io](https://codecov.io/gh/reportportal/agent-Python-RobotFramework/branch/develop/graph/badge.svg)](https://codecov.io/gh/reportportal/agent-Python-RobotFramework)
[![Join Slack chat!](https://slack.epmrpp.reportportal.io/badge.svg)](https://slack.epmrpp.reportportal.io/)
[![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal)
[![Build with Love](https://img.shields.io/badge/build%20with-❤%EF%B8%8F%E2%80%8D-lightgrey.svg)](http://reportportal.io?style=flat)
Expand All @@ -26,26 +26,6 @@ The latest stable version of library is available on PyPI:

pip install robotframework-reportportal

[reportportal-client](https://github.com/reportportal/client-Python)
and [six](https://pypi.org/project/six/) will be installed as dependencies

**IMPORTANT!**
The latest version **does not** support Report Portal versions below 5.0.0.

Specify the last one release of the client version 3 to install or update the
client for other versions of Report Portal below 5.0.0:

```
pip install robotframework-reportportal~=3.0
```

## Contribution

All the fixes for the agent that supports Report Portal versions below 5.0.0
should go into the v3 branch.
The master branch will store the code base for the agent for Report Portal
versions 5 and above.

## Usage

### Properties
Expand All @@ -66,14 +46,24 @@ REQUIRED:
NOT REQUIRED:

```
--variable RP_CLIENT_TYPE:"SYNC"
- Type of the under-the-hood ReportPortal client implamentation. Possible values: [SYNC, ASYNC_THREAD, ASYNC_BATCHED].
--variable RP_LAUNCH_UUID:"id_of_existing_rp_launch"
- ID of existing Report Portal launch
--variable RP_LAUNCH_DOC:"some_documentation_for_launch"
- Description for the launch
--variable RP_LAUNCH_ATTRIBUTES:"RF tag_name:tag_value"
- Space-separated list of tags/attributes for the launch
--variable RP_LAUNCH_UUID_PRINT:"True"
- Default value is "False", enables printing Launch UUID on test run start.
--variable RP_LAUNCH_UUID_PRINT_OUTPUT:"stderr"
- Default value is "stdout", Launch UUID print output. Possible values: [stderr, stdout].
--variable RP_TEST_ATTRIBUTES:"key1:value1 key1:value2 tag key2:value3"
- Space-separated list of tags/attributes for the tests
--variable RP_CONNECT_TIMEOUT:"20"
- Default value is "10.0", connection timeout to ReportPortal server.
--variable RP_READ_TIMEOUT:"20"
- Default value is "10.0", response read timeout for ReportPortal connection.
--variable RP_LOG_BATCH_SIZE:"10"
- Default value is "20", affects size of async batch log requests
--variable RP_LOG_BATCH_PAYLOAD_SIZE:"10240000"
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Basic dependencies
python-dateutil>=2.8.1
reportportal-client==5.4.0
python-dateutil~=2.8.1
reportportal-client~=5.5.1
robotframework
six>=1.15.0
4 changes: 2 additions & 2 deletions robotframework_reportportal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"""This package contains modules for reporting to Report Portal."""

# Copyright (c) 2023 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,3 +10,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

"""This package contains modules for reporting to Report Portal."""
18 changes: 5 additions & 13 deletions robotframework_reportportal/listener.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"""This module includes Robot Framework listener interfaces."""

# Copyright 2023 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""This module includes Robot Framework listener interfaces."""

import logging
import os
from functools import wraps
from mimetypes import guess_type
from typing import Optional, Dict, Union, Any
from queue import LifoQueue
from warnings import warn

from reportportal_client.helpers import gen_attributes
from reportportal_client.helpers import gen_attributes, LifoQueue

from .model import Keyword, Launch, Test, LogMessage, Suite
from .service import RobotService
Expand All @@ -32,13 +31,6 @@
logger = logging.getLogger(__name__)


class _LifoQueue(LifoQueue):
def last(self):
with self.mutex:
if self._qsize():
return self.queue[-1]


def check_rp_enabled(func):
"""Verify is RP is enabled in config."""
@wraps(func)
Expand All @@ -54,14 +46,14 @@ def wrap(*args, **kwargs):
class listener:
"""Robot Framework listener interface for reporting to Report Portal."""

_items: _LifoQueue = ...
_items: LifoQueue = ...
_service: Optional[RobotService] = ...
_variables: Optional[Variables] = ...
ROBOT_LISTENER_API_VERSION = 2

def __init__(self) -> None:
"""Initialize listener attributes."""
self._items = _LifoQueue()
self._items = LifoQueue()
self._service = None
self._variables = None

Expand Down
17 changes: 5 additions & 12 deletions robotframework_reportportal/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"""This module contains models representing Robot Framework test items."""

# Copyright (c) 2023 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,10 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License

import os
"""This module contains models representing Robot Framework test items."""

from reportportal_client.helpers import convert_string
from six import text_type
import os


class Suite(object):
Expand Down Expand Up @@ -184,14 +181,10 @@ def __init__(self, name, attributes, parent_type=None):

def get_name(self):
"""Get name of the keyword suitable for Report Portal."""
assign = convert_string(', '.join(self.assign))
assign = ', '.join(self.assign)
assignment = '{0} = '.format(assign) if self.assign else ''
arguments = ', '.join(self.args)
full_name = '{0}{1} ({2})'.format(
assignment,
convert_string(self.name),
convert_string(arguments)
)
full_name = f'{assignment}{self.name} ({arguments})'
return full_name[:256]

def get_type(self):
Expand All @@ -216,7 +209,7 @@ def update(self, attributes):
return self


class LogMessage(text_type):
class LogMessage(str):
"""Class represents Robot Framework messages."""

def __init__(self, message):
Expand Down
139 changes: 69 additions & 70 deletions robotframework_reportportal/model.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,92 +11,91 @@
# See the License for the specific language governing permissions and
# limitations under the License

from six import text_type
from typing import Any, Dict, List, Optional, Text, Tuple, Union
from typing import Any, Dict, List, Optional, Tuple, Union

class Suite:
attributes: Union[List[Text], Dict[Text]] = ...
doc: Text = ...
end_time: Text = ...
longname: Text = ...
message: Text = ...
metadata: Dict[Text, Text] = ...
name: Text = ...
robot_id: Text = ...
rp_item_id: Optional[Text] = ...
rp_parent_item_id: Optional[Text] = ...
start_time: Optional[Text] = ...
statistics: Text = ...
status: Text = ...
suites: List[Text] = ...
tests: List[Text] = ...
attributes: Union[List[str], Dict[str, Any]] = ...
doc: str = ...
end_time: str = ...
longname: str = ...
message: str = ...
metadata: Dict[str, str] = ...
name: str = ...
robot_id: str = ...
rp_item_id: Optional[str] = ...
rp_parent_item_id: Optional[str] = ...
start_time: Optional[str] = ...
statistics: str = ...
status: str = ...
suites: List[str] = ...
tests: List[str] = ...
total_tests: int = ...
type: Text = 'SUITE'
def __init__(self, name: Text, attributes: Dict[Text, Any]) -> None: ...
type: str = 'SUITE'
def __init__(self, name: str, attributes: Dict[str, Any]) -> None: ...
@property
def source(self) -> Text: ...
def update(self, attributes: Dict[Text, Any]) -> Union[Launch, Suite]: ...
def source(self) -> str: ...
def update(self, attributes: Dict[str, Any]) -> Union[Launch, Suite]: ...

class Launch(Suite):
type: Text = 'LAUNCH'
def __init__(self, name: Text, attributes: Dict[Text, Any]) -> None: ...
type: str = 'LAUNCH'
def __init__(self, name: str, attributes: Dict[str, Any]) -> None: ...

class Test:
_critical: Text = ...
_tags: List[Text] = ...
_attributes: Dict[Text, Any] = ...
attributes: List[Dict[Text, Text]] = ...
doc: Text = ...
end_time: Text = ...
longname: Text = ...
message: Text = ...
name: Text = ...
robot_id: Text = ...
rp_item_id: Optional[Text] = ...
rp_parent_item_id: Optional[Text] = ...
start_time: Text = ...
status: Text = ...
template: Text = ...
type: Text = 'TEST'
def __init__(self, name: Text, attributes: Dict[Text, Any]) -> None: ...
_critical: str = ...
_tags: List[str] = ...
_attributes: Dict[str, Any] = ...
attributes: List[Dict[str, str]] = ...
doc: str = ...
end_time: str = ...
longname: str = ...
message: str = ...
name: str = ...
robot_id: str = ...
rp_item_id: Optional[str] = ...
rp_parent_item_id: Optional[str] = ...
start_time: str = ...
status: str = ...
template: str = ...
type: str = 'TEST'
def __init__(self, name: str, attributes: Dict[str, Any]) -> None: ...
@property
def critical(self) -> bool: ...
@property
def tags(self) -> List[Text]: ...
def tags(self) -> List[str]: ...
@property
def source(self) -> Text: ...
def source(self) -> str: ...
@property
def code_ref(self) -> Text: ...
def code_ref(self) -> str: ...
@property
def test_case_id(self) -> Optional[Text]: ...
def update(self, attributes: Dict[Text, Any]) -> Test: ...
def test_case_id(self) -> Optional[str]: ...
def update(self, attributes: Dict[str, Any]) -> Test: ...

class Keyword:
attributes: Dict[Text, Any] = ...
args: List[Text] = ...
assign: List[Text] = ...
doc: Text = ...
end_time: Text = ...
keyword_name: Text = ...
keyword_type: Text = ...
libname: Text = ...
name: Text = ...
rp_item_id: Optional[Text] = ...
rp_parent_item_id: Optional[Text] = ...
parent_type: Text = ...
start_time: Text = ...
status: Text = ...
tags: List[Text] = ...
type: Text = 'KEYWORD'
def __init__(self, name: Text, attributes: Dict[Text, Any], parent_type: Optional[Text] = None) -> None: ...
def get_name(self) -> Text: ...
def get_type(self) -> Text: ...
def update(self, attributes: Dict[Text, Any]) -> Keyword: ...
attributes: Dict[str, Any] = ...
args: List[str] = ...
assign: List[str] = ...
doc: str = ...
end_time: str = ...
keyword_name: str = ...
keyword_type: str = ...
libname: str = ...
name: str = ...
rp_item_id: Optional[str] = ...
rp_parent_item_id: Optional[str] = ...
parent_type: str = ...
start_time: str = ...
status: str = ...
tags: List[str] = ...
type: str = 'KEYWORD'
def __init__(self, name: str, attributes: Dict[str, Any], parent_type: Optional[str] = None) -> None: ...
def get_name(self) -> str: ...
def get_type(self) -> str: ...
def update(self, attributes: Dict[str, Any]) -> Keyword: ...

class LogMessage(text_type):
attachment: Optional[Dict[Text, Text]] = ...
class LogMessage(str):
attachment: Optional[Dict[str, str]] = ...
launch_log: bool = ...
item_id: Optional[Text] = ...
level: Text = ...
message: Text = ...
item_id: Optional[str] = ...
level: str = ...
message: str = ...
def __init__(self, *args: Tuple, **kwargs: Dict) -> None: ...
2 changes: 1 addition & 1 deletion robotframework_reportportal/result_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from datetime import datetime

from robot.api import ResultVisitor
from six.moves.urllib.parse import unquote
from urllib.parse import unquote

from . import listener
from .time_visitor import corrections
Expand Down
Loading

0 comments on commit 87ecd45

Please sign in to comment.