14
0

- Use pytest to run the testsuite.

- Add patch import-from-non-pythonpath-files.patch:
  * Allow the test suite to find modules not shipped as modules.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pdfminer.six?expand=0&rev=7
This commit is contained in:
2021-11-09 07:33:46 +00:00
committed by Git OBS Bridge
parent 74eddac484
commit 41ebe191d8
3 changed files with 48 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
Index: pdfminer.six-20200726/tests/test_tools_dumppdf.py
===================================================================
--- pdfminer.six-20200726.orig/tests/test_tools_dumppdf.py
+++ pdfminer.six-20200726/tests/test_tools_dumppdf.py
@@ -5,8 +5,11 @@ from tempfile import NamedTemporaryFile
from helpers import absolute_sample_path
from pdfminer.pdfdocument import PDFNoValidXRefWarning
-from tools import dumppdf
+import importlib.util
+spec = importlib.util.spec_from_file_location("dumppdf", "tools/dumppdf.py")
+dumppdf = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(dumppdf)
def run(filename, options=None):
absolute_path = absolute_sample_path(filename)
Index: pdfminer.six-20200726/tests/test_tools_pdf2txt.py
===================================================================
--- pdfminer.six-20200726.orig/tests/test_tools_pdf2txt.py
+++ pdfminer.six-20200726/tests/test_tools_pdf2txt.py
@@ -4,9 +4,13 @@ import os
from shutil import rmtree
from tempfile import NamedTemporaryFile, mkdtemp
-import tools.pdf2txt as pdf2txt
from helpers import absolute_sample_path
+import importlib.util
+spec = importlib.util.spec_from_file_location("pdf2txt", "tools/pdf2txt.py")
+pdf2txt = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(pdf2txt)
+
def run(sample_path, options=None):
absolute_path = absolute_sample_path(sample_path)

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Nov 9 07:32:27 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Use pytest to run the testsuite.
- Add patch import-from-non-pythonpath-files.patch:
* Allow the test suite to find modules not shipped as modules.
-------------------------------------------------------------------
Tue Sep 8 16:58:08 UTC 2020 - pgajdos@suse.com

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pdfminer.six
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -27,9 +27,9 @@ URL: https://github.com/pdfminer/pdfminer.six
Source: https://github.com/pdfminer/pdfminer.six/archive/%{version}.tar.gz#/pdfminer.six-%{version}.tar.gz
# https://github.com/pdfminer/pdfminer.six/pull/489
Patch0: python-pdfminer.six-remove-nose.patch
Patch1: import-from-non-pythonpath-files.patch
BuildRequires: %{python_module chardet}
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module nose}
BuildRequires: %{python_module pycryptodome}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
@@ -43,7 +43,7 @@ Requires: python-pycryptodome
Requires: python-six
Requires: python-sortedcontainers
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(postun):update-alternatives
Provides: python-pdfminer3k = %{version}
Obsoletes: python-pdfminer3k < %{version}
BuildArch: noarch
@@ -63,7 +63,7 @@ of text analysis.
%prep
%setup -q -n pdfminer.six-%{version}
%patch0 -p1
%autopatch -p1
sed -i -e '/^#!\//, 1d' pdfminer/psparser.py
sed -i '1i #!%{_bindir}/python3' tools/dumppdf.py tools/pdf2txt.py
@@ -80,7 +80,7 @@ mv %{buildroot}%{_bindir}/pdf2txt.py %{buildroot}%{_bindir}/pdf2txt
%python_clone -a %{buildroot}%{_bindir}/dumppdf
%check
%python_expand nosetests-%{$python_bin_suffix} -v
%pytest
%post
%python_install_alternative pdf2txt