From acf8bec5090ef8ea9a534cfb236ff62d863c0ca8f2f555e6e90d2e8a762dc11e Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 10 Jan 2019 01:20:45 +0000 Subject: [PATCH] - Added denose.patch removing dependency on the nose package. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Pygments?expand=0&rev=46 --- denose.patch | 208 ++++++++++++++++++++++++++++++++++++++++ python-Pygments.changes | 5 + python-Pygments.spec | 15 ++- 3 files changed, 223 insertions(+), 5 deletions(-) create mode 100644 denose.patch diff --git a/denose.patch b/denose.patch new file mode 100644 index 0000000..e86dc95 --- /dev/null +++ b/denose.patch @@ -0,0 +1,208 @@ +--- a/tests/run.py ++++ b/tests/run.py +@@ -16,18 +16,13 @@ from __future__ import print_function + + import os + import sys ++import unittest + + # only find tests in this directory + if os.path.dirname(__file__): + os.chdir(os.path.dirname(__file__)) + + +-try: +- import nose +-except ImportError: +- print('nose is required to run the Pygments test suite') +- sys.exit(1) +- + # make sure the current source is first on sys.path + sys.path.insert(0, '..') + +@@ -47,4 +42,4 @@ else: + print('Pygments test suite running (Python %s)...' % sys.version.split()[0], + file=sys.stderr) + +-nose.main() ++unittest.main() +--- a/tests/support.py ++++ b/tests/support.py +@@ -5,7 +5,7 @@ Support for Pygments tests + + import os + +-from nose import SkipTest ++from unittest import SkipTest + + + def location(mod_name): +--- a/tests/test_cmdline.py ++++ b/tests/test_cmdline.py +@@ -143,7 +143,7 @@ class CmdLineTest(unittest.TestCase): + + def test_h_opt(self): + o = self.check_success('-h') +- self.assertTrue('Usage:' in o) ++ self.assertIn('Usage:', o) + + def test_L_opt(self): + o = self.check_success('-L') +@@ -157,37 +157,37 @@ class CmdLineTest(unittest.TestCase): + filename = TESTFILE + o = self.check_success('-Ofull=1,linenos=true,foo=bar', + '-fhtml', filename) +- self.assertTrue('foo, bar=baz=,' in o) ++ self.assertIn('foo, bar=baz=,', o) + + def test_F_opt(self): + filename = TESTFILE + o = self.check_success('-Fhighlight:tokentype=Name.Blubb,' + 'names=TESTFILE filename', + '-fhtml', filename) +- self.assertTrue(' + +- Added denose.patch removing dependency on the nose package. + ------------------------------------------------------------------- Tue Dec 4 12:52:17 UTC 2018 - Matej Cepl diff --git a/python-Pygments.spec b/python-Pygments.spec index a52a861..7655027 100644 --- a/python-Pygments.spec +++ b/python-Pygments.spec @@ -1,7 +1,7 @@ # # spec file for package python-Pygments # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,8 +26,11 @@ Group: Development/Languages/Python URL: http://pygments.org Source: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz Patch0: python_37.diff -BuildRequires: %{python_module nose} +Patch1: denose.patch BuildRequires: %{python_module setuptools} +# We need unittest2 just because of its test runner, it seems even +# python3 stdlib unittest runner doesn't work +BuildRequires: %{python_module pytest} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-setuptools @@ -55,7 +58,7 @@ source code. Highlights are: %prep %setup -q -n Pygments-%{version} -%patch0 -p1 +%autopatch -p1 # Remove non-oss licensed files, see bnc# 760344 rm tests/examplefiles/{Sorting,test}.mod @@ -66,6 +69,7 @@ rm tests/examplefiles/{Sorting,test}.mod %python_install %{python_expand %$python_install mv %{buildroot}%{_bindir}/pygmentize %{buildroot}%{_bindir}/pygmentize-%{$python_bin_suffix} +rm -rf %{buildroot}%{$python_sitelib}/tests %fdupes -s %{buildroot}%{$python_sitelib} %if "%{python3_bin_suffix}" != "" install -Dm0644 doc/pygmentize.1 %{buildroot}%{_mandir}/man1/pygmentize.1 @@ -81,8 +85,9 @@ install -Dm0644 doc/pygmentize.1 %{buildroot}%{_mandir}/man1/pygmentize.1 %python_install_alternative pygmentize %check -export PYTHONDEBUG=1 -%python_exec tests/run.py +# export PYTHONDEBUG=1 +export PYTHONPATH=tests +%python_expand py.test-%{$python_bin_suffix} --disable-warnings -v tests %files %{python_files} %license LICENSE