Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #377

Merged
merged 47 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1da174d
Changelog update
autoreportportal Sep 6, 2024
3eee0ee
Version update
autoreportportal Sep 6, 2024
d32a089
Action version update
HardNorth Sep 6, 2024
9eb7885
Add tests and hook skeletons
HardNorth Oct 15, 2024
83a390d
Update typing
HardNorth Oct 16, 2024
2bf08db
Update typing and docs
HardNorth Oct 16, 2024
20f85b7
Implement fixture handling
HardNorth Oct 16, 2024
f5d5c84
Dependencies update
HardNorth Oct 16, 2024
2d4568b
Remove redundant code
HardNorth Oct 16, 2024
ef71851
Refactoring, add fixture report parameter
HardNorth Oct 16, 2024
d929237
Test examples update
HardNorth Oct 17, 2024
54aba5e
Test formatting update
HardNorth Oct 17, 2024
22b024a
Add fixture on/off test
HardNorth Oct 17, 2024
9c6e081
Fix import
HardNorth Oct 17, 2024
86e264d
Revert typing changes
HardNorth Oct 17, 2024
8b013df
Fix tests
HardNorth Oct 17, 2024
428dc3b
Fix for Python 3.7
HardNorth Oct 17, 2024
3070a68
Fix for Python 3.7
HardNorth Oct 17, 2024
512ad53
Fix for Python 3.7
HardNorth Oct 17, 2024
6d95984
Fix tests
HardNorth Oct 17, 2024
5b6fd5d
Backward compatibility fixes
HardNorth Oct 17, 2024
9226957
Fix pydocstyle
HardNorth Oct 17, 2024
a18098d
Fix warnings
HardNorth Oct 17, 2024
4b52e5a
Add more tests
HardNorth Oct 17, 2024
72b1b36
Fix codestyle
HardNorth Oct 18, 2024
48224c5
Add another test example
HardNorth Oct 18, 2024
be62554
Update examples
HardNorth Oct 18, 2024
fcd2667
Update examples
HardNorth Oct 18, 2024
9ee0aa2
Add more tests
HardNorth Oct 18, 2024
511a64c
Add more tests
HardNorth Oct 18, 2024
1643370
Add more examples
HardNorth Oct 18, 2024
d9ffe35
Add more tests
HardNorth Oct 18, 2024
105f910
Add more tests
HardNorth Oct 18, 2024
5b0cf3b
Add more tests
HardNorth Oct 21, 2024
13d8b38
Test fixes
HardNorth Oct 21, 2024
8b13307
Refactoring
HardNorth Oct 21, 2024
3e153f2
Refactoring
HardNorth Oct 21, 2024
461203f
Refactoring
HardNorth Oct 21, 2024
bad8bed
Refactoring
HardNorth Oct 21, 2024
21b321d
CHANGELOG.md update
HardNorth Oct 21, 2024
172dca7
Add some type hinting
HardNorth Oct 21, 2024
8022b26
Code style fix
HardNorth Oct 21, 2024
634ac32
Code style fix
HardNorth Oct 21, 2024
51124a8
Add parent item ID check
HardNorth Oct 21, 2024
1b4caba
Add type hinting
HardNorth Oct 21, 2024
76ceae6
Max Item name fix
HardNorth Oct 21, 2024
7e4ece0
Merge pull request #376 from reportportal/EPMRPP-96192_add_fixtures_t…
HardNorth Oct 21, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}

- name: Setup git credentials
uses: oleksiyrudenko/gha-git-credentials@v2.1.1
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
name: 'reportportal.io'
email: '[email protected]'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]
### Fixed
- Issue [#375](https://github.com/reportportal/agent-python-pytest/issues/375): Fix max Item name length, by @HardNorth
### Added
- Issue [#332](https://github.com/reportportal/agent-python-pytest/issues/332): Support for fixture reporting, by @HardNorth

## [5.4.2]
### Fixed
- Issue [#368](https://github.com/reportportal/agent-python-pytest/issues/368): Distutils in the agent, by @HardNorth
- Pytest Tavern plugin support, by @virdok
### Added
Expand Down
15 changes: 0 additions & 15 deletions examples/__init__.py

This file was deleted.

23 changes: 23 additions & 0 deletions examples/fixtures/class_fixture_return/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 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 unittest import mock

import pytest


@pytest.fixture(scope='class')
def class_fixture_return_config():
print('setup')
return mock.Mock()
40 changes: 40 additions & 0 deletions examples/fixtures/class_fixture_return/test_fixture_class_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024 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.
#
# 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.

class TestClassOne:
def test_fixture_class_setup_first(self, class_fixture_return_config):
assert class_fixture_return_config is not None

def test_fixture_class_setup_second(self, class_fixture_return_config):
assert class_fixture_return_config is not None


class TestClassTwo:
def test_fixture_class_setup_forth(self, class_fixture_return_config):
assert class_fixture_return_config is not None

def test_fixture_class_setup_fifth(self, class_fixture_return_config):
assert class_fixture_return_config is not None
23 changes: 23 additions & 0 deletions examples/fixtures/module_fixture_return/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 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 unittest import mock

import pytest


@pytest.fixture(scope='module')
def module_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2024 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.
#
# 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.

def test_fixture_module_setup_first(module_fixture_return_config):
assert module_fixture_return_config is not None


def test_fixture_module_setup_second(module_fixture_return_config):
assert module_fixture_return_config is not None
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Copyright (c) 2022 https://reportportal.io .
# Copyright 2024 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
# 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
# limitations under the License.
23 changes: 23 additions & 0 deletions examples/fixtures/package_fixture_return/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 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 unittest import mock

import pytest


@pytest.fixture(scope='package')
def package_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 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.
#
# 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.

def test_fixture_package_setup_first(package_fixture_return_config):
assert package_fixture_return_config is not None
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 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.
#
# 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.

def test_fixture_package_setup_second(package_fixture_return_config):
assert package_fixture_return_config is not None
23 changes: 23 additions & 0 deletions examples/fixtures/session_fixture_return/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 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 unittest import mock

import pytest


@pytest.fixture(scope='session')
def session_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 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.
#
# 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.


def test_fixture_session_setup_first(session_fixture_return_config):
assert session_fixture_return_config is not None
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 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.
#
# 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.


def test_fixture_session_setup_second(session_fixture_return_config):
assert session_fixture_return_config is not None
33 changes: 33 additions & 0 deletions examples/fixtures/test_failure_fixture_teardown/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2024 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 logging
from unittest import mock

import pytest
from reportportal_client import RPLogger

LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
logging.setLoggerClass(RPLogger)

LOG_MESSAGE_BEFORE_YIELD = 'Log message before yield and test failure'
LOG_MESSAGE_TEARDOWN = 'Log message for teardown after test failure'


@pytest.fixture
def test_failure_fixture_teardown_config():
logging.error(LOG_MESSAGE_BEFORE_YIELD)
yield mock.Mock()
logging.error(LOG_MESSAGE_TEARDOWN)
Loading