Accepting request 1226226 from devel:languages:python:pytest
- 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/request/show/1226226 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-spec?expand=0&rev=7
This commit is contained in:
commit
a6dd35100c
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4af154588195f4bb6c62d6ca030a20218db7d80b675a08897d9a99239ea3d087
|
||||
size 16980
|
3
pytest_spec-4.0.0.tar.gz
Normal file
3
pytest_spec-4.0.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:71c9985e97d090a69b1f1b7adb64e7a208fb1ac42432ce9566c32cdd6b44c1ad
|
||||
size 1192093
|
@ -1,378 +0,0 @@
|
||||
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
|
||||
|
@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-pytest-spec
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# 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
|
||||
@ -16,16 +16,17 @@
|
||||
#
|
||||
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-pytest-spec
|
||||
Version: 3.2.0
|
||||
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
|
||||
# https://github.com/pchomik/pytest-spec/compare/3.2.0...master
|
||||
Patch1: python-pytest-spec-nopython2.patch
|
||||
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
|
||||
@ -38,15 +39,13 @@ BuildRequires: %{python_module pytest}
|
||||
pytest plugin to display test execution output like a specification.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n pytest-spec-%{version}
|
||||
%autosetup -p1 -n pytest_spec-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%python_install
|
||||
# Do not install tests
|
||||
%python_expand rm -r %{buildroot}%{$python_sitelib}/test
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
@ -55,6 +54,7 @@ pytest plugin to display test execution output like a specification.
|
||||
%files %{python_files}
|
||||
%doc README.md
|
||||
%license LICENSE.txt
|
||||
%{python_sitelib}/pytest_spec*
|
||||
%{python_sitelib}/pytest_spec
|
||||
%{python_sitelib}/pytest_spec-%{version}.dist-info
|
||||
|
||||
%changelog
|
||||
|
Loading…
x
Reference in New Issue
Block a user