- update to 4.0.0:

* v.4.0.0
  * Drop support for Python 2.7, 3.5, 3.6, 3.7
  * Added support for Python 3.11, 3.12
  * Migrate project back to pip from poetry
  * Replace mock by version from stdlib
- drop python-pytest-spec-nopython2.patch: upstream

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-spec?expand=0&rev=15
This commit is contained in:
Dirk Mueller 2024-11-25 09:29:00 +00:00 committed by Git OBS Bridge
commit 9f31634bf9
7 changed files with 541 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
pytest-spec-3.2.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4af154588195f4bb6c62d6ca030a20218db7d80b675a08897d9a99239ea3d087
size 16980

3
pytest_spec-4.0.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:71c9985e97d090a69b1f1b7adb64e7a208fb1ac42432ce9566c32cdd6b44c1ad
size 1192093

View File

@ -0,0 +1,378 @@
diff --git a/README.md b/README.md
index b6dcf76..c1c8004 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
<p>
<h1 align="center">pytest-spec</h1>
<p align="center">
- <img src="https://badgen.net/badge/python/2.7/green">
<img src="https://badgen.net/badge/python/3.5/green">
<img src="https://badgen.net/badge/python/3.6/green">
<img src="https://badgen.net/badge/python/3.7/green">
@@ -45,9 +44,15 @@
### spec_header_format
-You can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles):
+You can configure the format of the test headers by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](https://docs.pytest.org/en/stable/customize.html#pytest-ini):
+
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_header_format = {module_path}:
+
+ ; legacy pytest
[tool:pytest]
spec_header_format = {module_path}:
```
@@ -56,7 +61,7 @@ In addition to the ``{path}`` and ``{class_name}`` replacement fields, there is
### spec_test_format
-You can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](http://doc.pytest.org/en/latest/customize.html#inifiles):
+You can configure the format of the test results by specifying a [format string](https://docs.python.org/2/library/string.html#format-string-syntax) in your [ini-file](https://docs.pytest.org/en/stable/customize.html#pytest-ini):
3 variables are available:
* result - place for indicator
@@ -64,6 +69,11 @@ You can configure the format of the test results by specifying a [format string]
* docstring_summary - first line from test docstring if available
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_test_format = {result} {name}
+
+ ; legacy pytest
[tool:pytest]
spec_test_format = {result} {name}
```
@@ -71,6 +81,11 @@ You can configure the format of the test results by specifying a [format string]
or
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_test_format = {result} {docstring_summary}
+
+ ; legacy pytest
[tool:pytest]
spec_test_format = {result} {docstring_summary}
```
@@ -82,6 +97,11 @@ In second example where docstring is not available the name will be added to spe
You can configure the indicator displayed when test passed.
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_success_indicator = ✓
+
+ ; legacy pytest
[tool:pytest]
spec_success_indicator = ✓
```
@@ -91,6 +111,11 @@ You can configure the indicator displayed when test passed.
You can configure the indicator displated when test failed.
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_failure_indicator = ✗
+
+ ; legacy pytest
[tool:pytest]
spec_failure_indicator = ✗
```
@@ -100,6 +125,11 @@ You can configure the indicator displated when test failed.
You can configure the indicator displated when test is skipped.
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_skipped_indicator = ?
+
+ ; legacy pytest
[tool:pytest]
spec_skipped_indicator = ?
```
@@ -110,6 +140,11 @@ Comma-separated settings to ignore/hide some tests or output from from plugins l
Any test which contain provided string will be ignored in output spec.
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_ignore = FLAKE8
+
+ ; legacy pytest
[tool:pytest]
spec_ignore = FLAKE8
```
@@ -117,6 +152,11 @@ Any test which contain provided string will be ignored in output spec.
### spec_indent
```ini
+ ; since pytest 4.6.x
+ [pytest]
+ spec_indent = " "
+
+ ; legacy pytest
[tool:pytest]
spec_indent = " "
```
diff --git a/pyproject.toml b/pyproject.toml
index ca689f9..08ebe3e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,8 +12,8 @@ classifiers = [
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
- "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
@@ -30,10 +30,9 @@ packages = [
include = ["LICENSE.txt"]
[tool.poetry.dependencies]
-six = "*"
+python = ">=3.5"
[tool.poetry.dev-dependencies]
-mock = ">1.0.1"
pytest = "*"
pytest-describe = "*"
pytest-flake8 = "*"
diff --git a/pytest_spec/__init__.py b/pytest_spec/__init__.py
index 55ea5f7..141763d 100644
--- a/pytest_spec/__init__.py
+++ b/pytest_spec/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
"""
diff --git a/pytest_spec/patch.py b/pytest_spec/patch.py
index 2110e82..a39ccce 100644
--- a/pytest_spec/patch.py
+++ b/pytest_spec/patch.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Module contains method that will be replaced by the plugin.
:author: Pawel Chomicki
@@ -183,7 +182,7 @@ def _get_test_name(nodeid):
test_name_parts = test_name.split(' ')
if len(test_name_parts) == 1:
return test_name.strip().capitalize()
- return 'The ({0}) {1}'.format(test_name_parts[0][1:].replace(' ', '_'), test_name_parts[1])
+ return 'The ({}) {}'.format(test_name_parts[0][1:].replace(' ', '_'), test_name_parts[1])
return test_name
diff --git a/pytest_spec/plugin.py b/pytest_spec/plugin.py
index 08c76ff..f32e3b3 100644
--- a/pytest_spec/plugin.py
+++ b/pytest_spec/plugin.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Module contains command line option definition and logic needed to enable new formatting.
:author: Pawel Chomicki
@@ -57,12 +56,12 @@ def pytest_addoption(parser):
def pytest_configure(config):
if getattr(config.option, 'spec', 0) and not getattr(config.option, 'quiet', 0) and not getattr(config.option, 'verbose', 0):
- import six
+ import importlib
import _pytest
_pytest.terminal.TerminalReporter.pytest_runtest_logstart = logstart_replacer
_pytest.terminal.TerminalReporter.pytest_runtest_logreport = report_replacer
_pytest.terminal.TerminalReporter.pytest_collection_modifyitems = modifyitems_replacer
- six.moves.reload_module(_pytest)
+ importlib.reload(_pytest)
@pytest.mark.hookwrapper
diff --git a/pytest_spec/replacer.py b/pytest_spec/replacer.py
index 8d81184..83a6f0a 100644
--- a/pytest_spec/replacer.py
+++ b/pytest_spec/replacer.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Module contains method for replace operation.
Additional method are necessary because self is not yet defined and module
diff --git a/test/test_formats/test_describe_format.py b/test/test_formats/test_describe_format.py
index 602c9a5..adc1070 100644
--- a/test/test_formats/test_describe_format.py
+++ b/test/test_formats/test_describe_format.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
:e-mail: pawel.chomicki@gmail.com
diff --git a/test/test_formats/test_functions.py b/test/test_formats/test_functions.py
index 020d401..4763bf9 100644
--- a/test/test_formats/test_functions.py
+++ b/test/test_formats/test_functions.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
:e-mail: pawel.chomicki@gmail.com
diff --git a/test/test_formats/test_methods.py b/test/test_formats/test_methods.py
index 077e178..09cc005 100644
--- a/test/test_formats/test_methods.py
+++ b/test/test_formats/test_methods.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
:e-mail: pawel.chomicki@gmail.com
@@ -6,7 +5,7 @@
import unittest
-class SomeClass(object):
+class SomeClass:
def some_method(self, arg):
return arg
diff --git a/test/test_patch.py b/test/test_patch.py
index 05ec407..df7956d 100644
--- a/test/test_patch.py
+++ b/test/test_patch.py
@@ -1,16 +1,15 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
"""
import unittest
-from mock import Mock, call
+from unittest.mock import Mock, call
import pytest_spec
from pytest_spec.patch import pytest_runtest_logstart, pytest_runtest_logreport
-class FakeHook(object):
+class FakeHook:
def __init__(self, *args, **kwargs):
self.cat = kwargs.get('cat', ' ')
self.letter = kwargs.get('letter', ' ')
@@ -20,7 +19,7 @@ def pytest_report_teststatus(self, report, config):
return self.cat, self.letter, self.word
-class FakeConfig(object):
+class FakeConfig:
def __init__(self, *args, **kwargs):
self.hook = FakeHook(*args, **kwargs)
@@ -43,12 +42,12 @@ def getini(self, option):
return result
-class FakeStats(object):
+class FakeStats:
def setdefault(self, first, second):
return []
-class FakeSelf(object):
+class FakeSelf:
def __init__(self, *args, **kwargs):
self.config = FakeConfig(*args, **kwargs)
self.currentfspath = None
@@ -56,7 +55,7 @@ def __init__(self, *args, **kwargs):
self.stats = FakeStats()
-class FakeReport(object):
+class FakeReport:
def __init__(self, nodeid, *args, **kwargs):
self.nodeid = nodeid
self.passed = kwargs.get('passed', True)
diff --git a/test/test_plugin.py b/test/test_plugin.py
index 2bcaec4..0d27972 100755
--- a/test/test_plugin.py
+++ b/test/test_plugin.py
@@ -1,20 +1,19 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
"""
import unittest
-from mock import Mock, call, patch
+from unittest.mock import Mock, call, patch
from pytest_spec.plugin import pytest_addoption, pytest_configure
-class FakeOption(object):
+class FakeOption:
def __init__(self, spec=False):
self.spec = spec
self.verbose = 0
-class FakeConfig(object):
+class FakeConfig:
def __init__(self, spec):
self.option = FakeOption(spec=spec)
@@ -34,12 +33,12 @@ def test__pytest_adoption__adds_spec_option(self):
dest='spec',
help='Print test result in specification format')])
- @patch('six.moves.reload_module')
+ @patch('importlib.reload')
def test__pytest_configure__should_not_reload_configuration(self, imp_mock):
pytest_configure(FakeConfig(spec=False))
self.assertEqual(len(imp_mock.mock_calls), 0)
- @patch('six.moves.reload_module')
+ @patch('importlib.reload')
def test__pytest_configure__reloads_pytest_after_patching(self, imp_mock):
pytest_configure(FakeConfig(spec=True))
self.assertEqual(len(imp_mock.mock_calls), 1)
diff --git a/test/test_replacer.py b/test/test_replacer.py
index 9526bc1..1106cdf 100644
--- a/test/test_replacer.py
+++ b/test/test_replacer.py
@@ -1,10 +1,9 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
"""
import unittest
-from mock import patch
+from unittest.mock import patch
from pytest_spec.replacer import logstart_replacer, report_replacer
diff --git a/test/test_results/test_as_class.py b/test/test_results/test_as_class.py
index 5445dec..2ffeb60 100644
--- a/test/test_results/test_as_class.py
+++ b/test/test_results/test_as_class.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
:e-mail: pawel.chomicki@gmail.com
diff --git a/test/test_results/test_as_functions.py b/test/test_results/test_as_functions.py
index f725e61..5154531 100644
--- a/test/test_results/test_as_functions.py
+++ b/test/test_results/test_as_functions.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
:author: Pawel Chomicki
:e-mail: pawel.chomicki@gmail.com

View File

@ -0,0 +1,74 @@
-------------------------------------------------------------------
Mon Nov 25 09:28:38 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 4.0.0:
* v.4.0.0
* Drop support for Python 2.7, 3.5, 3.6, 3.7
* Added support for Python 3.11, 3.12
* Migrate project back to pip from poetry
* Replace mock by version from stdlib
- drop python-pytest-spec-nopython2.patch: upstream
-------------------------------------------------------------------
Thu Sep 14 11:59:56 UTC 2023 - pgajdos@suse.com
- drop python2 support completely, python-six not required
- deleted patches
- remove-mock.patch (upstreamed)
- added patches
fix https://github.com/pchomik/pytest-spec/compare/3.2.0...master
+ python-pytest-spec-nopython2.patch
-------------------------------------------------------------------
Thu Mar 24 01:24:23 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 3.2.0:
* Added support for multiline docstrings
* Added logic to use docstring_summary instead of test name
* Added logic to ignore some tests from spec output
* Changed indicator for skipped tests
* Improve formatting for functions
* Changed actions to test against python and pytest versions
* Added tests to sdist
- Add patch remove-mock.patch:
* Use stdlib unittest.mock
- Correct filelist, and do not install test directory under sitelib.
- Remove mock from {Build,}Requires, add six.
- Drop seperate LICENSE, it's now included.
- Actually run the testsuite.
-------------------------------------------------------------------
Thu Nov 5 15:35:43 UTC 2020 - Marketa Machova <mmachova@suse.com>
- Update to 3.0.5
* Fixed SyntaxWarning issue
* Fixed output format for pytest-describe
* Active plugin only if -q or -v was not provided
* Fixed Python 2/3 warnings
* Added support for Python 3.9
-------------------------------------------------------------------
Wed Dec 18 04:32:03 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Dropped no longer necessary pytest4.patch
- Update to v2.0.0
* Update documentation
* New format of output
* Fix small warnings
* Generate the package in wheel format
-------------------------------------------------------------------
Thu Aug 22 09:01:23 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add patches to work with new pytest:
* pytest4.patch
-------------------------------------------------------------------
Thu Mar 21 09:58:53 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Use noun phrase in summary.
-------------------------------------------------------------------
Thu Mar 21 01:32:16 AM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v1.1.0

59
python-pytest-spec.spec Normal file
View File

@ -0,0 +1,59 @@
#
# spec file for package python-pytest-spec
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: python-pytest-spec
Version: 4.0.0
Release: 0
Summary: Plugin to display pytest execution output like a specification
License: GPL-2.0-only
URL: https://github.com/pchomik/pytest-spec
Source: https://files.pythonhosted.org/packages/source/p/pytest-spec/pytest_spec-%{version}.tar.gz
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module pytest}
# /SECTION
%python_subpackages
%description
pytest plugin to display test execution output like a specification.
%prep
%autosetup -p1 -n pytest_spec-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%doc README.md
%license LICENSE.txt
%{python_sitelib}/pytest_spec
%{python_sitelib}/pytest_spec-%{version}.dist-info
%changelog