Skip to content

Commit

Permalink
Merge pull request #146 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth authored Jun 23, 2022
2 parents fa71204 + 0be2783 commit 11de870
Show file tree
Hide file tree
Showing 39 changed files with 496 additions and 99 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths-ignore:
- '.github/**'
- CHANGELOG.md
- README.rst
- README.md
- CONTRIBUTING.rst

env:
Expand Down Expand Up @@ -61,6 +61,12 @@ jobs:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}

- name: Checkout develop branch
uses: actions/checkout@v2
with:
ref: 'develop'
fetch-depth: 0

- name: Update CHANGELOG.md
id: changelogUpdate
run: |
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Tests

on: [push, pull_request]
on:
push:
branches:
- '*'
- '!master'
pull_request:
branches:
- 'master'
- 'develop'

jobs:
build:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

## [Unreleased]
### Added
- `RP_LOG_BATCH_PAYLOAD_SIZE` parameter, by @HardNorth
### Changed
- Client version updated on [5.2.3](https://github.com/reportportal/client-Python/releases/tag/5.2.3), by @HardNorth
- The agent switched to use new client with async log processing, by @HardNorth

## [5.2.2]
### Fixed
- Issue [#140](https://github.com/reportportal/agent-Python-RobotFramework/issues/140) Process test message at the end of the test, by @iivanou
- Issue [#139](https://github.com/reportportal/agent-Python-RobotFramework/issues/139) Broken view in Before/After Suites items, by @HardNorth
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ NOT REQUIRED:
- Space-separated list of tags/attributes for the tests
--variable RP_LOG_BATCH_SIZE:"10"
- Default value is "20", affects size of async batch log requests
--variable RP_LOG_BATCH_PAYLOAD_SIZE:"10240000"
- Default value is "65000000", maximum payload size of async batch log
requests
--variable RP_RERUN:"True"
- Default is "False". Enables rerun mode for the last launch.
--variable RP_RERUN_OF:"xxxxx-xxxx-xxxx-lauch-uuid"
Expand Down
5 changes: 5 additions & 0 deletions examples/custom_test_case_id.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

*** Test Cases ***
Custom Test Case ID
[Tags] test_case_id:custom
Log Hello, world!
4 changes: 4 additions & 0 deletions examples/simple.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

*** Test Cases ***
Simple test
Log Hello, world!
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python-dateutil>=2.8.1
reportportal-client>=5.0.11
reportportal-client>=5.2.3
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,10 +1,10 @@
"""This package contains module for reporting to Report Portal.
Copyright (c) 2021 http://reportportal.io .
Copyright (c) 2021 https://reportportal.io .
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
4 changes: 2 additions & 2 deletions robotframework_reportportal/exception.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""This module includes exceptions used across the agent modules.
Copyright (c) 2021 http://reportportal.io .
Copyright (c) 2021 https://reportportal.io .
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
4 changes: 3 additions & 1 deletion robotframework_reportportal/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

import logging
import os
from mimetypes import guess_type
Expand Down Expand Up @@ -104,7 +105,8 @@ def service(self):
log_batch_size=self.variables.log_batch_size,
pool_size=self.variables.pool_size,
skipped_issue=self.variables.skipped_issue,
verify_ssl=self.variables.verify_ssl
verify_ssl=self.variables.verify_ssl,
log_batch_payload_size=self.variables.log_batch_payload_size
)
return self._service

Expand Down
14 changes: 14 additions & 0 deletions robotframework_reportportal/listener.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

from logging import Logger
from .model import Keyword as Keyword, Launch as Launch, LogMessage as LogMessage, Suite as Suite, Test as Test
from .service import RobotService as RobotService
Expand Down
14 changes: 14 additions & 0 deletions robotframework_reportportal/logger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

"""Report Portal logging API for test libraries with support for attachments.
Usage of this logger is similar to the standard robot.api.logger with addition
Expand Down
5 changes: 3 additions & 2 deletions robotframework_reportportal/model.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
"""This module contains models representing Robot Framework test items.
Copyright (c) 2021 http://reportportal.io .
Copyright (c) 2021 https://reportportal.io .
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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.
"""

import os

from reportportal_client.service import _convert_string
Expand Down
14 changes: 14 additions & 0 deletions robotframework_reportportal/model.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

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

Expand Down
14 changes: 14 additions & 0 deletions robotframework_reportportal/post_report.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

"""Robot Framework test report sender to Report Portal.
This tool replays a Robot Framework test session using the output XML file
Expand Down
14 changes: 14 additions & 0 deletions robotframework_reportportal/result_visitor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

import re
import string
from datetime import datetime
Expand Down
15 changes: 14 additions & 1 deletion robotframework_reportportal/result_visitor.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# make_stub_files: Thu 22 Oct 2020 at 15:38:24
# Copyright 2022 EPAM Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

from typing import Pattern, List
from .listener import listener as ls
from robot.result import ResultVisitor, Result, TestSuite, TestCase, Keyword, Message
Expand Down
47 changes: 27 additions & 20 deletions robotframework_reportportal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

from dateutil.parser import parse
import logging

from reportportal_client.core.log_manager import MAX_LOG_BATCH_PAYLOAD_SIZE
from reportportal_client.external.google_analytics import send_event
from reportportal_client.helpers import (
dict_to_payload,
get_launch_sys_attrs,
get_package_version,
timestamp
)
from reportportal_client.service import (
_dict_to_payload,
ReportPortalService
)
from reportportal_client.client import RPClient

from .exception import RobotServiceException
from .static import LOG_LEVEL_MAPPING, STATUS_MAPPING
Expand Down Expand Up @@ -67,35 +67,42 @@ def _get_launch_attributes(self, cmd_attrs):
system_attributes = get_launch_sys_attrs()
system_attributes['agent'] = (
'{}-{}'.format(self.agent_name, self.agent_version))
return attributes + _dict_to_payload(system_attributes)
return attributes + dict_to_payload(system_attributes)

def init_service(self, endpoint, project, uuid, log_batch_size, pool_size,
skipped_issue=True, verify_ssl=True):
"""Initialize common reportportal client.
:param endpoint: Report Portal API endpoint
:param project: Report Portal project
:param uuid: API token
:param log_batch_size: Number of logs to be sent within one batch
:param pool_size: HTTPAdapter max pool size
:param skipped_issue Mark skipped test items with 'To Investigate',
default value 'True'
:param verify_ssl: Disable SSL verification
skipped_issue=True, verify_ssl=True,
log_batch_payload_size=MAX_LOG_BATCH_PAYLOAD_SIZE):
"""Initialize common Report Portal client.
:param endpoint: Report Portal API endpoint
:param project: Report Portal project
:param uuid: API token
:param log_batch_size: Number of logs to be sent within one
batch
:param pool_size: HTTPAdapter max pool size
:param skipped_issue: Mark skipped test items with
'To Investigate', default value 'True'
:param verify_ssl: Disable SSL verification.
:param log_batch_payload_size: Maximum size of logs to be sent within
one batch
"""
if self.rp is None:
logger.debug(
'ReportPortal - Init service: '
'endpoint={0}, project={1}, uuid={2}'
.format(endpoint, project, uuid))
self.rp = ReportPortalService(
self.rp = RPClient(
endpoint=endpoint,
project=project,
token=uuid,
is_skipped_an_issue=skipped_issue,
log_batch_size=log_batch_size,
retries=True,
verify_ssl=verify_ssl,
max_pool_size=pool_size,
is_skipped_an_issue=skipped_issue,
verify_ssl=verify_ssl
log_batch_payload_size=log_batch_payload_size
)
self.rp.start()
else:
raise RobotServiceException(
'RobotFrameworkService is already initialized.')
Expand Down Expand Up @@ -124,7 +131,7 @@ def start_launch(self, launch, mode=None, rerun=False, rerun_of=None,
'name': launch.name,
'mode': mode,
'rerun': rerun,
'rerunOf': rerun_of,
'rerun_of': rerun_of,
'start_time': ts or to_epoch(launch.start_time) or timestamp()
}
logger.debug(
Expand Down
Loading

0 comments on commit 11de870

Please sign in to comment.