Accepting request 918650 from devel:languages:python
- Add patch migrate-to-pytest.patch: * Migrate to pytest, lightly rebased from upstream. OBS-URL: https://build.opensuse.org/request/show/918650 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-releases?expand=0&rev=6
This commit is contained in:
commit
18c5b853e2
316
migrate-to-pytest.patch
Normal file
316
migrate-to-pytest.patch
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
From 94bb11bfe6a9583896de6d54861af68e9ce6b957 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeff Forcier <jeff@bitprophet.org>
|
||||||
|
Date: Fri, 17 Jan 2020 15:16:49 -0500
|
||||||
|
Subject: [PATCH] Migrate to pytest-relaxed from spec
|
||||||
|
|
||||||
|
---
|
||||||
|
dev-requirements.txt | 3 +-
|
||||||
|
docs/changelog.rst | 2 ++
|
||||||
|
integration/integration.py | 6 ++--
|
||||||
|
integration/util.py | 66 ++++++++++++++++++++------------------
|
||||||
|
setup.cfg | 4 +++
|
||||||
|
tasks.py | 7 ++--
|
||||||
|
tests/_util.py | 6 ++--
|
||||||
|
tests/organization.py | 35 ++++++++++----------
|
||||||
|
tests/presentation.py | 25 +++++++--------
|
||||||
|
9 files changed, 80 insertions(+), 74 deletions(-)
|
||||||
|
|
||||||
|
Index: releases-1.6.3/dev-requirements.txt
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/dev-requirements.txt
|
||||||
|
+++ releases-1.6.3/dev-requirements.txt
|
||||||
|
@@ -2,7 +2,8 @@
|
||||||
|
invoke>=0.6.0,<2.0
|
||||||
|
invocations>=0.14,<2.0
|
||||||
|
# Tests (N.B. integration suite also uses Invoke as above)
|
||||||
|
-spec>=0.11.3,<2.0
|
||||||
|
+pytest-relaxed==1.1.5
|
||||||
|
+pytest==4.6.9
|
||||||
|
mock==1.0.1
|
||||||
|
# Just for tests...heh
|
||||||
|
six>=1.4.1,<2.0
|
||||||
|
Index: releases-1.6.3/docs/changelog.rst
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/docs/changelog.rst
|
||||||
|
+++ releases-1.6.3/docs/changelog.rst
|
||||||
|
@@ -2,6 +2,8 @@
|
||||||
|
Changelog
|
||||||
|
=========
|
||||||
|
|
||||||
|
+- :support:`-` Migrated the test suite to use ``pytest-relaxed`` (and thus
|
||||||
|
+ pytest) instead of ``spec``.
|
||||||
|
- :release:`1.6.3 <2020-01-10>`
|
||||||
|
- :support:`87 backported` (via :issue:`88`) Our upper Sphinx version limit was
|
||||||
|
mostly defensive and at this point is just too old to even build on
|
||||||
|
Index: releases-1.6.3/tasks.py
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/tasks.py
|
||||||
|
+++ releases-1.6.3/tasks.py
|
||||||
|
@@ -1,17 +1,14 @@
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
|
from invocations import docs
|
||||||
|
-from invocations.testing import test, integration, watch_tests
|
||||||
|
+from invocations.pytest import test, integration
|
||||||
|
from invocations.packaging import release
|
||||||
|
|
||||||
|
from invoke import Collection
|
||||||
|
|
||||||
|
|
||||||
|
-ns = Collection(test, integration, watch_tests, release, docs)
|
||||||
|
+ns = Collection(test, integration, release, docs)
|
||||||
|
ns.configure({
|
||||||
|
- 'tests': {
|
||||||
|
- 'package': 'releases',
|
||||||
|
- },
|
||||||
|
'packaging': {
|
||||||
|
'sign': True,
|
||||||
|
'wheel': True,
|
||||||
|
Index: releases-1.6.3/tests/_util.py
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/tests/_util.py
|
||||||
|
+++ releases-1.6.3/tests/_util.py
|
||||||
|
@@ -2,7 +2,6 @@ from docutils.nodes import (
|
||||||
|
list_item, paragraph,
|
||||||
|
)
|
||||||
|
from mock import Mock
|
||||||
|
-from spec import eq_, ok_
|
||||||
|
import six
|
||||||
|
|
||||||
|
from releases import (
|
||||||
|
@@ -108,9 +107,10 @@ def expect_releases(entries, release_map
|
||||||
|
err += "\nFull changelog: {!r}\n"
|
||||||
|
for rel, issues in six.iteritems(release_map):
|
||||||
|
found = changelog.pop(rel)
|
||||||
|
- eq_(set(found), set(issues), err.format(rel, issues, found, snapshot))
|
||||||
|
+ msg = err.format(rel, issues, found, snapshot)
|
||||||
|
+ assert set(found) == set(issues), msg
|
||||||
|
# Sanity: ensure no leftover issue lists exist (empty ones are OK)
|
||||||
|
for key in list(changelog.keys()):
|
||||||
|
if not changelog[key]:
|
||||||
|
del changelog[key]
|
||||||
|
- ok_(not changelog, "Found leftovers: {}".format(changelog))
|
||||||
|
+ assert not changelog, "Found leftovers: {}".format(changelog)
|
||||||
|
Index: releases-1.6.3/tests/organization.py
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/tests/organization.py
|
||||||
|
+++ releases-1.6.3/tests/organization.py
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
import six
|
||||||
|
-from spec import Spec, eq_, raises, skip
|
||||||
|
+from pytest import skip
|
||||||
|
+from pytest_relaxed import raises
|
||||||
|
from docutils.nodes import (
|
||||||
|
list_item, raw, paragraph, Text,
|
||||||
|
)
|
||||||
|
@@ -20,7 +21,7 @@ from _util import (
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
-class organization(Spec):
|
||||||
|
+class organization(object):
|
||||||
|
"""
|
||||||
|
Organization of issues into releases (parsing)
|
||||||
|
"""
|
||||||
|
@@ -30,7 +31,7 @@ class organization(Spec):
|
||||||
|
def _expect_entries(self, all_entries, in_, not_in):
|
||||||
|
# Grab 2nd release as 1st is the empty 'beginning of time' one
|
||||||
|
entries = releases(*all_entries)[1]['entries']
|
||||||
|
- eq_(len(entries), len(in_))
|
||||||
|
+ assert len(entries) == len(in_)
|
||||||
|
for x in in_:
|
||||||
|
assert x in entries
|
||||||
|
for x in not_in:
|
||||||
|
@@ -86,22 +87,22 @@ class organization(Spec):
|
||||||
|
fake = list_item('', paragraph('', '', raw('', 'whatever')))
|
||||||
|
changelog = releases('1.0.2', self.f, fake)
|
||||||
|
entries = changelog[1]['entries']
|
||||||
|
- eq_(len(entries), 1)
|
||||||
|
+ assert len(entries) == 1
|
||||||
|
assert self.f not in entries
|
||||||
|
assert isinstance(entries[0], Issue)
|
||||||
|
- eq_(entries[0].number, None)
|
||||||
|
+ assert entries[0].number is None
|
||||||
|
|
||||||
|
def unreleased_items_go_in_unreleased_releases(self):
|
||||||
|
changelog = releases(self.f, self.b)
|
||||||
|
# Should have two unreleased lists, one feature w/ feature, one bugfix
|
||||||
|
# w/ bugfix.
|
||||||
|
bugfix, feature = changelog[1:]
|
||||||
|
- eq_(len(feature['entries']), 1)
|
||||||
|
- eq_(len(bugfix['entries']), 1)
|
||||||
|
+ assert len(feature['entries']) == 1
|
||||||
|
+ assert len(bugfix['entries']) == 1
|
||||||
|
assert self.f in feature['entries']
|
||||||
|
assert self.b in bugfix['entries']
|
||||||
|
- eq_(feature['obj'].number, 'unreleased_1.x_feature')
|
||||||
|
- eq_(bugfix['obj'].number, 'unreleased_1.x_bugfix')
|
||||||
|
+ assert feature['obj'].number == 'unreleased_1.x_feature'
|
||||||
|
+ assert bugfix['obj'].number == 'unreleased_1.x_bugfix'
|
||||||
|
|
||||||
|
def issues_consumed_by_releases_are_not_in_unreleased(self):
|
||||||
|
changelog = releases('1.0.2', self.f, self.b, self.s, self.bs)
|
||||||
|
@@ -148,7 +149,7 @@ class organization(Spec):
|
||||||
|
('1.1.2', [b50, b42]),
|
||||||
|
('1.2.1', [b50, b42]),
|
||||||
|
):
|
||||||
|
- eq_(set(c[rel]), set(issues))
|
||||||
|
+ assert set(c[rel]) == set(issues)
|
||||||
|
|
||||||
|
def releases_can_specify_issues_explicitly(self):
|
||||||
|
# Build regular list-o-entries
|
||||||
|
@@ -218,7 +219,7 @@ class organization(Spec):
|
||||||
|
def duplicate_issue_numbers_adds_two_issue_items(self):
|
||||||
|
test_changelog = releases('1.0.1', self.b, self.b)
|
||||||
|
test_changelog = changelog2dict(test_changelog)
|
||||||
|
- eq_(len(test_changelog['1.0.1']), 2)
|
||||||
|
+ assert len(test_changelog['1.0.1']) == 2
|
||||||
|
|
||||||
|
def duplicate_zeroes_dont_error(self):
|
||||||
|
cl = releases('1.0.1', b(0), b(0))
|
||||||
|
@@ -239,7 +240,7 @@ class organization(Spec):
|
||||||
|
# Order should be feature, bug, support. While it doesn't REALLY
|
||||||
|
# matter, assert that within each category the order matches the old
|
||||||
|
# 'reverse chronological' order.
|
||||||
|
- eq_(changelog['1.1'], [f2, f1, b2, b1, s2, s1])
|
||||||
|
+ assert changelog['1.1'], [f2, f1, b2, b1, s2 == s1]
|
||||||
|
|
||||||
|
def rolling_release_works_without_annotation(self):
|
||||||
|
b1 = b(1)
|
||||||
|
@@ -397,8 +398,8 @@ class organization(Spec):
|
||||||
|
second = changelog['0.1.1']
|
||||||
|
assert b1 in first
|
||||||
|
assert f2 in first
|
||||||
|
- eq_(len(first), 3) # Meh, hard to assert about the implicit one
|
||||||
|
- eq_(second, [b3])
|
||||||
|
+ assert len(first) == 3 # Meh, hard to assert about the implicit one
|
||||||
|
+ assert second == [b3]
|
||||||
|
|
||||||
|
def specs_and_keywords_play_together_nicely(self):
|
||||||
|
b1 = b(1)
|
||||||
|
@@ -429,13 +430,13 @@ class organization(Spec):
|
||||||
|
def changelogs_without_any_releases_display_unreleased_normally(self):
|
||||||
|
changelog = releases(self.f, self.b, skip_initial=True)
|
||||||
|
# Ensure only the two unreleased 'releases' showed up
|
||||||
|
- eq_(len(changelog), 2)
|
||||||
|
+ assert len(changelog) == 2
|
||||||
|
# And assert that both items appeared in one of them (since there's no
|
||||||
|
# real releases at all, the bugfixes are treated as 'major' bugs, as
|
||||||
|
# per concepts doc.)
|
||||||
|
bugfix, feature = changelog
|
||||||
|
- eq_(len(feature['entries']), 2)
|
||||||
|
- eq_(len(bugfix['entries']), 0)
|
||||||
|
+ assert len(feature['entries']) == 2
|
||||||
|
+ assert len(bugfix['entries']) == 0
|
||||||
|
|
||||||
|
class unstable_prehistory:
|
||||||
|
def _expect_releases(self, *args, **kwargs):
|
||||||
|
Index: releases-1.6.3/tests/presentation.py
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/tests/presentation.py
|
||||||
|
+++ releases-1.6.3/tests/presentation.py
|
||||||
|
@@ -1,4 +1,3 @@
|
||||||
|
-from spec import Spec, eq_
|
||||||
|
from docutils.nodes import (
|
||||||
|
reference, bullet_list, list_item, literal, raw, paragraph, Text
|
||||||
|
)
|
||||||
|
@@ -30,7 +29,7 @@ def _expect_type(node, cls):
|
||||||
|
assert isinstance(node, cls), msg
|
||||||
|
|
||||||
|
|
||||||
|
-class presentation(Spec):
|
||||||
|
+class presentation(object):
|
||||||
|
"""
|
||||||
|
Expansion/extension of docutils nodes (rendering)
|
||||||
|
"""
|
||||||
|
@@ -58,7 +57,7 @@ class presentation(Spec):
|
||||||
|
assert expected in header
|
||||||
|
elif type_ == 'issue':
|
||||||
|
link = nodes[0][1][0][0][2]
|
||||||
|
- eq_(link['refuri'], expected)
|
||||||
|
+ assert link['refuri'] == expected
|
||||||
|
else:
|
||||||
|
raise Exception("Gave unknown type_ kwarg to _test_link()!")
|
||||||
|
|
||||||
|
@@ -139,7 +138,7 @@ class presentation(Spec):
|
||||||
|
Text("fixes an issue in "), literal('', 'methodname')))
|
||||||
|
node = self._generate('1.0.2', fake)
|
||||||
|
# [<raw prefix>, <inline colon>, <inline space>, <text>, <monospace>]
|
||||||
|
- eq_(len(node[0]), 5)
|
||||||
|
+ assert len(node[0]) == 5
|
||||||
|
assert 'Bug' in str(node[0][0])
|
||||||
|
assert 'fixes an issue' in str(node[0][3])
|
||||||
|
assert 'methodname' in str(node[0][4])
|
||||||
|
@@ -149,7 +148,7 @@ class presentation(Spec):
|
||||||
|
fake = list_item('', paragraph('', '', raw('', 'whatever')))
|
||||||
|
node = self._generate('0.1.0', fake, app=app, skip_initial=True)
|
||||||
|
# [<raw bug text>]
|
||||||
|
- eq_(len(node[0]), 1)
|
||||||
|
+ assert len(node[0]) == 1
|
||||||
|
assert 'Bug' not in str(node[0][0])
|
||||||
|
assert 'whatever' in str(node[0][0])
|
||||||
|
|
||||||
|
@@ -173,9 +172,9 @@ class presentation(Spec):
|
||||||
|
)
|
||||||
|
# Trailing nodes should appear post-processing after the link/etc
|
||||||
|
rest = self._generate('1.0.2', issue)[0]
|
||||||
|
- eq_(len(rest), 5)
|
||||||
|
+ assert len(rest) == 5
|
||||||
|
_expect_type(rest[4], raw)
|
||||||
|
- eq_(rest[4].astext(), 'x')
|
||||||
|
+ assert rest[4].astext() == 'x'
|
||||||
|
|
||||||
|
def complex_descriptions_are_preserved(self):
|
||||||
|
# Complex 'entry' mapping to an outer list_item (list) containing two
|
||||||
|
@@ -188,14 +187,14 @@ class presentation(Spec):
|
||||||
|
li = self._generate('1.0.2', issue)
|
||||||
|
# Expect that the machinery parsing issue nodes/nodelists, is not
|
||||||
|
# discarding our 2nd 'paragraph'
|
||||||
|
- eq_(len(li), 2)
|
||||||
|
+ assert len(li) == 2
|
||||||
|
p1, p2 = li
|
||||||
|
# Last item in 1st para is our 1st raw node
|
||||||
|
_expect_type(p1[4], raw)
|
||||||
|
- eq_(p1[4].astext(), 'x')
|
||||||
|
+ assert p1[4].astext() == 'x'
|
||||||
|
# Only item in 2nd para is our 2nd raw node
|
||||||
|
_expect_type(p2[0], raw)
|
||||||
|
- eq_(p2[0].astext(), 'y')
|
||||||
|
+ assert p2[0].astext() == 'y'
|
||||||
|
|
||||||
|
def descriptions_are_parsed_for_issue_roles(self):
|
||||||
|
item = list_item('',
|
||||||
|
@@ -207,11 +206,11 @@ class presentation(Spec):
|
||||||
|
assert not isinstance(para[4], Issue)
|
||||||
|
# First/primary link
|
||||||
|
_expect_type(para[2], reference)
|
||||||
|
- eq_(para[2].astext(), '#15')
|
||||||
|
+ assert para[2].astext() == '#15'
|
||||||
|
assert 'Bug' in para[0].astext()
|
||||||
|
# Second/inline link
|
||||||
|
_expect_type(para[6], reference)
|
||||||
|
- eq_(para[6].astext(), '#5')
|
||||||
|
+ assert para[6].astext() == '#5'
|
||||||
|
assert 'Support' in para[4].astext()
|
||||||
|
|
||||||
|
def unreleased_buckets_omit_major_version_when_only_one_exists(self):
|
||||||
|
@@ -246,7 +245,7 @@ class presentation(Spec):
|
||||||
|
)
|
||||||
|
# Expectation: [1.x unreleased, 1.0.1] - no 2.x.
|
||||||
|
result = self._generate(*entries, raw=True)
|
||||||
|
- eq_(len(result), 2)
|
||||||
|
+ assert len(result) == 2
|
||||||
|
html = str(result[0][0][0])
|
||||||
|
assert "Next 1.x bugfix release" in html
|
||||||
|
|
||||||
|
Index: releases-1.6.3/setup.cfg
|
||||||
|
===================================================================
|
||||||
|
--- releases-1.6.3.orig/setup.cfg
|
||||||
|
+++ releases-1.6.3/setup.cfg
|
||||||
|
@@ -10,3 +10,6 @@ universal = 1
|
||||||
|
tag_build =
|
||||||
|
tag_date = 0
|
||||||
|
|
||||||
|
+[tool:pytest]
|
||||||
|
+testpaths = tests
|
||||||
|
+python_files = *
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 13 06:17:58 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch migrate-to-pytest.patch:
|
||||||
|
* Migrate to pytest, lightly rebased from upstream.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon May 25 21:27:01 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
Mon May 25 21:27:01 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python
|
# spec file
|
||||||
#
|
#
|
||||||
# Copyright (c) 2020 SUSE LLC
|
# Copyright (c) 2021 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -33,6 +33,7 @@ License: BSD-2-Clause
|
|||||||
URL: https://github.com/bitprophet/releases
|
URL: https://github.com/bitprophet/releases
|
||||||
Source: https://files.pythonhosted.org/packages/source/r/releases/releases-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/r/releases/releases-%{version}.tar.gz
|
||||||
Patch0: semanticversioning.patch
|
Patch0: semanticversioning.patch
|
||||||
|
Patch1: migrate-to-pytest.patch
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -45,9 +46,9 @@ BuildRequires: %{python_module Sphinx >= 1.3}
|
|||||||
BuildRequires: %{python_module invocations}
|
BuildRequires: %{python_module invocations}
|
||||||
BuildRequires: %{python_module invoke}
|
BuildRequires: %{python_module invoke}
|
||||||
BuildRequires: %{python_module mock >= 1.0.1}
|
BuildRequires: %{python_module mock >= 1.0.1}
|
||||||
|
BuildRequires: %{python_module pytest-relaxed}
|
||||||
BuildRequires: %{python_module semantic_version}
|
BuildRequires: %{python_module semantic_version}
|
||||||
BuildRequires: %{python_module six >= 1.4.1}
|
BuildRequires: %{python_module six >= 1.4.1}
|
||||||
BuildRequires: %{python_module spec >= 0.11.3}
|
|
||||||
%endif
|
%endif
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ Specifically:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n releases-%{version}
|
%setup -q -n releases-%{version}
|
||||||
%patch0 -p1
|
%autopatch -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
|
Loading…
Reference in New Issue
Block a user