14
0

Compare commits

6 Commits

Author SHA256 Message Date
6b74cb4bef Accepting request 1301513 from devel:languages:python
- Replace python-blockdiag-nose-to-pytest.patch with a different
  upstream patch to also drop use of yield tests.

OBS-URL: https://build.opensuse.org/request/show/1301513
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-blockdiag?expand=0&rev=13
2025-08-27 19:34:48 +00:00
a3edc68c72 - Replace python-blockdiag-nose-to-pytest.patch with a different
upstream patch to also drop use of yield tests.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-blockdiag?expand=0&rev=30
2025-08-27 02:56:11 +00:00
bf4d23982c Accepting request 1282830 from devel:languages:python
- fix usage of libalternatives

OBS-URL: https://build.opensuse.org/request/show/1282830
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-blockdiag?expand=0&rev=12
2025-06-04 18:30:13 +00:00
994c4f39c1 - fix usage of libalternatives
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-blockdiag?expand=0&rev=28
2025-06-04 14:59:01 +00:00
fe14607c6b Accepting request 1277708 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1277708
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-blockdiag?expand=0&rev=11
2025-05-15 15:02:45 +00:00
229448d5d0 - Convert to pip-based build
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-blockdiag?expand=0&rev=26
2025-05-15 11:04:45 +00:00
3 changed files with 162 additions and 33 deletions

View File

@@ -1,3 +1,15 @@
From 4f4f726252084f17ecc6c524592222af09d37da4 Mon Sep 17 00:00:00 2001
From: Guillaume Grossetie <ggrossetie@yuzutech.fr>
Date: Mon, 10 Jul 2023 00:31:37 +0200
Subject: [PATCH] Switch to pytest (nose is unmaintained and does not work on
Python3.10)
---
setup.py | 3 +-
src/blockdiag/tests/test_generate_diagram.py | 95 ++++++++++----------
tox.ini | 2 +-
3 files changed, 49 insertions(+), 51 deletions(-)
Index: blockdiag-3.0.0/setup.py
===================================================================
--- blockdiag-3.0.0.orig/setup.py
@@ -23,39 +35,139 @@ Index: blockdiag-3.0.0/src/blockdiag/tests/test_generate_diagram.py
===================================================================
--- blockdiag-3.0.0.orig/src/blockdiag/tests/test_generate_diagram.py
+++ blockdiag-3.0.0/src/blockdiag/tests/test_generate_diagram.py
@@ -19,8 +19,6 @@ import sys
@@ -19,7 +19,7 @@ import sys
import unittest
from xml.etree import ElementTree
-from nose.tools import nottest
-
+import pytest
import blockdiag
import blockdiag.command
from blockdiag.tests.utils import (TemporaryDirectory, capture_stderr,
@@ -52,7 +50,7 @@ def test_generate():
files = get_diagram_files(basepath)
options = []
@@ -38,7 +38,7 @@ def get_diagram_files(testdir):
diagramsdir = os.path.join(testdir, 'diagrams')
skipped = ['README', 'debian-logo-256color-palettealpha.png',
- 'errors', 'invalid.txt', 'white.gif']
+ 'errors', 'invalid.txt', 'white.gif', 'node_icon.diag']
for file in os.listdir(diagramsdir):
if file in skipped:
pass
@@ -46,66 +46,67 @@ def get_diagram_files(testdir):
yield os.path.join(diagramsdir, file)
-def test_generate():
- mainfunc = blockdiag.command.main
- basepath = os.path.dirname(__file__)
- files = get_diagram_files(basepath)
- options = []
+base_path = os.path.dirname(__file__)
+files = get_diagram_files(base_path)
+generate_testdata = []
+generate_with_separate_testdata = []
+for file_source in files:
+ generate_testdata.append((file_source, 'svg', []))
+ generate_testdata.append((file_source, 'png', []))
+ generate_testdata.append((file_source, 'png', ['--antialias']))
+ generate_testdata.append((file_source, 'pdf', []))
+ if re.search('separate', file_source):
+ generate_with_separate_testdata.append((file_source, 'svg', ['--separate']))
+ generate_with_separate_testdata.append((file_source, 'png', ['--separate']))
+ generate_with_separate_testdata.append((file_source, 'png', ['--separate', '--antialias']))
+ generate_with_separate_testdata.append((file_source, 'pdf', ['--separate']))
+
- for testcase in testcase_generator(basepath, mainfunc, files, options):
+ for testcase in _testcase_generator(basepath, mainfunc, files, options):
yield testcase
- yield testcase
+@pytest.mark.parametrize("source,file_type,options", generate_with_separate_testdata)
+def test_generate_with_separate_option(source, file_type, options):
+ mainfunc = blockdiag.command.main
+ generate(mainfunc, source, file_type, options)
@@ -63,12 +61,11 @@ def test_generate_with_separate():
filtered = (f for f in files if re.search('separate', f))
options = ['--separate']
-def test_generate_with_separate():
+@pytest.mark.parametrize("source,file_type,options", generate_testdata)
+def test_generate_with_separate(source, file_type, options):
mainfunc = blockdiag.command.main
- basepath = os.path.dirname(__file__)
- files = get_diagram_files(basepath)
- filtered = (f for f in files if re.search('separate', f))
- options = ['--separate']
-
- for testcase in testcase_generator(basepath, mainfunc, filtered, options):
+ for testcase in _testcase_generator(basepath, mainfunc, filtered, options):
yield testcase
- yield testcase
-
-
-@nottest
-def testcase_generator(basepath, mainfunc, files, options):
+def _testcase_generator(basepath, mainfunc, files, options):
fontpath = get_fontpath(basepath)
options = options + ['-f', fontpath]
- fontpath = get_fontpath(basepath)
- options = options + ['-f', fontpath]
+ generate(mainfunc, source, file_type, options)
- for source in files:
- yield generate, mainfunc, 'svg', source, options
+@capture_stderr
+def generate(mainfunc, source, file_type, options):
+ if file_type == 'png':
if not supported_pil():
- yield unittest.skip("Pillow is not available")(generate)
- yield unittest.skip("Pillow is not available")(generate)
- elif os.environ.get('ALL_TESTS') is None:
- message = "Skipped by default. To enable it, specify $ALL_TESTS=1"
- yield unittest.skip(message)(generate)
- yield unittest.skip(message)(generate)
- else:
- yield generate, mainfunc, 'png', source, options
- yield generate, mainfunc, 'png', source, options + ['--antialias']
-
+ unittest.skip('Pillow is not available')
+ return
+ if os.environ.get('ALL_TESTS') is None:
+ unittest.skip('Skipped by default. To enable it, specify $ALL_TESTS=1')
+ return
+ elif file_type == 'pdf':
if not supported_pdf():
- yield unittest.skip("reportlab is not available")(generate)
- elif os.environ.get('ALL_TESTS') is None:
- message = "Skipped by default. To enable it, specify $ALL_TESTS=1"
- yield unittest.skip(message)(generate)
- else:
- yield generate, mainfunc, 'pdf', source, options
-
+ unittest.skip('reportlab is not available')
+ return
+ if os.environ.get('ALL_TESTS') is None:
+ unittest.skip('Skipped by default. To enable it, specify $ALL_TESTS=1')
+ return
-@capture_stderr
-def generate(mainfunc, filetype, source, options):
+ tmpdir = None
try:
tmpdir = TemporaryDirectory()
- fd, tmpfile = tmpdir.mkstemp()
+ fd, tmp_file = tmpdir.mkstemp()
os.close(fd)
-
- mainfunc(['--debug', '-T', filetype, '-o', tmpfile, source] +
- list(options))
+ mainfunc(
+ [
+ '--debug',
+ '-T',
+ file_type,
+ '-o', tmp_file, source
+ ] + list(options)
+ )
finally:
- tmpdir.clean()
+ if tmpdir is not None:
+ tmpdir.clean()
def not_exist_font_config_option_test():
Index: blockdiag-3.0.0/tox.ini
===================================================================
--- blockdiag-3.0.0.orig/tox.ini

View File

@@ -1,3 +1,19 @@
-------------------------------------------------------------------
Wed Aug 27 02:55:25 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Replace python-blockdiag-nose-to-pytest.patch with a different
upstream patch to also drop use of yield tests.
-------------------------------------------------------------------
Wed Jun 4 14:58:34 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
- fix usage of libalternatives
-------------------------------------------------------------------
Wed May 14 12:28:44 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to pip-based build
-------------------------------------------------------------------
Tue Oct 3 12:06:41 UTC 2023 - Markéta Machová <mmachova@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-blockdiag
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,38 +16,39 @@
#
%bcond_without libalternatives
%{?sle15_python_module_pythons}
Name: python-blockdiag
Version: 3.0.0
Release: 0
Summary: Program to generate block-diagram images from text
License: Apache-2.0
Group: Development/Languages/Python
URL: http://blockdiag.com/
Source: https://files.pythonhosted.org/packages/source/b/blockdiag/blockdiag-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python-blockdiag-nose-to-pytest.patch gh#blockdiag/blockdiag#131 pgajdos@suse.com
# Remove the last silly dependency on nose
# PATCH-FIX-UPSTREAM Based on gh#blockdiag/blockdiag#175/commits/4f4f726252084f17ecc6c524592222af09d37da4
Patch0: python-blockdiag-nose-to-pytest.patch
# PATCH-FIX-UPSTREAM https://github.com/blockdiag/blockdiag/pull/179 Add support for Pillow 10
Patch1: pillow10.patch
BuildRequires: %{python_module Pillow >= 3}
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module funcparserlib >= 1.0.0~a0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module webcolors}
BuildRequires: %{python_module wheel}
BuildRequires: alts
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: alts
Requires: python-Pillow >= 3
Requires: python-funcparserlib >= 1.0.0~a0
Requires: python-setuptools
Requires: python-webcolors
Requires(post): update-alternatives
Requires(preun):update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module reportlab}
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module reportlab}
# /SECTION
%if 0%{?suse_version} || 0%{?fedora_version} >= 24
Recommends: ghostscript
@@ -64,18 +65,18 @@ from spec-text files.
%autosetup -p1 -n blockdiag-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/blockdiag
%post
%python_install_alternative blockdiag
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative blockdiag
%postun
%python_uninstall_alternative blockdiag
# post and postun macro call is not needed with only libalternatives
%check
pushd src
@@ -91,6 +92,6 @@ popd
%doc CHANGES.rst README.rst
%python_alternative %{_bindir}/blockdiag
%{python_sitelib}/blockdiag
%{python_sitelib}/blockdiag-%{version}*-info
%{python_sitelib}/blockdiag-%{version}.dist-info
%changelog