14
0

Accepting request 1128343 from home:mcalabkova:branches:devel:languages:python

- Update to 3.0.1
  * Add support for Python 3.11.
  * Drop support for Python 3.6.
- Add fix_tests.patch to fix tests one more time
  * from the commit message: "Doctests were a bad idea."

OBS-URL: https://build.opensuse.org/request/show/1128343
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-restview?expand=0&rev=15
This commit is contained in:
2023-11-23 13:52:44 +00:00
committed by Git OBS Bridge
parent 50bfb12c27
commit 5a8b476f75
5 changed files with 125 additions and 6 deletions

108
fix_tests.patch Normal file
View File

@@ -0,0 +1,108 @@
From 6a1d6b44ee400431d75ed2326bd0b4f35d4727fa Mon Sep 17 00:00:00 2001
From: Marius Gedminas <marius@gedmin.as>
Date: Mon, 21 Aug 2023 13:11:43 +0300
Subject: [PATCH] Fix tests
Not sure why they broke (new docutils release on PyPI)? Doctests were a
bad idea.
---
src/restview/tests.py | 58 +++++++++----------------------------------
1 file changed, 12 insertions(+), 46 deletions(-)
Index: restview-3.0.1/src/restview/tests.py
===================================================================
--- restview-3.0.1.orig/src/restview/tests.py
+++ restview-3.0.1/src/restview/tests.py
@@ -540,7 +540,7 @@ def doctest_RestViewer_rest_to_html():
... This is an inline literal: ``README.txt``.
... ''', settings={'cloak_email_addresses': True}).strip())
... # doctest: +ELLIPSIS,+REPORT_NDIFF
- <?xml version="1.0" encoding="utf-8" ?>
+ <?xml version="1.0" encoding="utf-8"...?>
<!DOCTYPE html...>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -581,34 +581,12 @@ def doctest_RestViewer_rest_to_html():
def doctest_RestViewer_rest_to_html_css_url():
"""Test for RestViewer.rest_to_html
- XXX: this shows pygments styles inlined *after* the external css, which
- means it's hard to override them!
-
>>> viewer = RestViewer('.')
>>> viewer.stylesheets = 'http://example.com/my.css'
- >>> print(viewer.rest_to_html(b'''
- ... Some text
- ... ''').strip())
- ... # doctest: +ELLIPSIS,+REPORT_NDIFF
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html...>
- ...
- <title>...</title>
+ >>> html = viewer.rest_to_html(b'Some text')
+ >>> grep('stylesheet', html)
<link rel="stylesheet" href="http://example.com/my.css" type="text/css" />
- <style type="text/css">
- ...
- </style>
- </head>
- <body>
- <main>
- <BLANKLINE>
- <BLANKLINE>
- <p>Some text</p>
- </main>
- </body>
- </html>
-
- """
+ """
def doctest_RestViewer_rest_to_html_strict_and_error_handling():
@@ -714,29 +692,16 @@ def doctest_RestViewer_rest_to_html_pypi
>>> viewer = RestViewer('.')
>>> viewer.stylesheets = None
>>> viewer.pypi_strict = True
- >>> print(viewer.rest_to_html(b'''
+ >>> html = viewer.rest_to_html(b'''
... Hello
... -----
...
... `This is fine <http://www.example.com>`__.
...
- ... ''').strip().replace("&quot;", '"'))
- ... # doctest: +ELLIPSIS,+REPORT_NDIFF
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html...>
- ...
+ ... ''')
+ >>> grep('Hello', html)
<title>Hello</title>
- <style type="text/css">
- ...
- </head>
- <body>
- <main id="hello">
<h1 class="title">Hello</h1>
- <BLANKLINE>
- <p><a href="http://www.example.com" rel="nofollow">This is fine</a>.</p>
- </main>
- </body>
- </html>
"""
@@ -1022,6 +987,12 @@ class TestMain(unittest.TestCase):
serve_called=True, browser_launched=True)
+def grep(needle, haystack):
+ for line in haystack.splitlines():
+ if needle in line:
+ print(line)
+
+
def test_suite():
return unittest.TestSuite([
unittest.defaultTestLoader.loadTestsFromName(__name__),

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Nov 23 13:41:52 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Update to 3.0.1
* Add support for Python 3.11.
* Drop support for Python 3.6.
- Add fix_tests.patch to fix tests one more time
* from the commit message: "Doctests were a bad idea."
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Dec 2 09:54:28 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com> Fri Dec 2 09:54:28 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-restview # spec file for package python-restview
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2023 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
@@ -17,7 +17,7 @@
Name: python-restview Name: python-restview
Version: 3.0.0 Version: 3.0.1
Release: 0 Release: 0
Summary: ReStructuredText viewer Summary: ReStructuredText viewer
License: GPL-3.0-only License: GPL-3.0-only
@@ -25,7 +25,9 @@ Group: Development/Languages/Python
URL: https://mg.pov.lt/restview/ URL: https://mg.pov.lt/restview/
Source: https://files.pythonhosted.org/packages/source/r/restview/restview-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/r/restview/restview-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-tests.patch gh#mgedmin/restview@5033eacb1d55 # PATCH-FIX-UPSTREAM fix-tests.patch gh#mgedmin/restview@5033eacb1d55
Patch1: fix-tests.patch Patch: fix-tests.patch
# PATCH-FIX-UPSTREAM fix_tests.patch gh#mgedmin/restview@6a1d6b44ee40
Patch: fix_tests.patch
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b989610aaed2fd42da64f6cdc539cf3ee70ce370bcba872db72421ad515dd1e
size 49774

3
restview-3.0.1.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c1a171c159d46d15d5569f77021828883a121d6f9baf758d641fc1e54b05ae5
size 49922