Accepting request 690449 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/690449
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Pygments?expand=0&rev=26
This commit is contained in:
Dominique Leuenberger 2019-04-04 10:04:03 +00:00 committed by Git OBS Bridge
commit 8e9834961d
3 changed files with 129 additions and 21 deletions

View File

@ -1,7 +1,5 @@
Index: Pygments-2.3.1/tests/run.py
===================================================================
--- Pygments-2.3.1.orig/tests/run.py
+++ Pygments-2.3.1/tests/run.py
--- a/tests/run.py
+++ b/tests/run.py
@@ -17,6 +17,7 @@ from __future__ import print_function
import os
import sys
@ -29,10 +27,8 @@ Index: Pygments-2.3.1/tests/run.py
-nose.main()
+unittest.main()
Index: Pygments-2.3.1/tests/support.py
===================================================================
--- Pygments-2.3.1.orig/tests/support.py
+++ Pygments-2.3.1/tests/support.py
--- a/tests/support.py
+++ b/tests/support.py
@@ -5,7 +5,7 @@ Support for Pygments tests
import os
@ -42,11 +38,42 @@ Index: Pygments-2.3.1/tests/support.py
def location(mod_name):
Index: Pygments-2.3.1/tests/test_cmdline.py
===================================================================
--- Pygments-2.3.1.orig/tests/test_cmdline.py
+++ Pygments-2.3.1/tests/test_cmdline.py
@@ -143,7 +143,7 @@ class CmdLineTest(unittest.TestCase):
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -16,11 +16,10 @@ import sys
import tempfile
import unittest
-import support
+from . import support
from pygments import cmdline, highlight
from pygments.util import BytesIO, StringIO
-
TESTFILE, TESTDIR = support.location(__file__)
TESTCODE = '''\
def func(args):
@@ -46,7 +45,7 @@ def run_cmdline(*args, **kwds):
new_stdin.write(kwds.get('stdin', ''))
new_stdin.seek(0, 0)
try:
- ret = cmdline.main(['pygmentize'] + list(args))
+ ret = cmdline.main(['./pygmentize'] + list(args))
finally:
sys.stdin = saved_stdin
sys.stdout = saved_stdout
@@ -111,8 +110,8 @@ class CmdLineTest(unittest.TestCase):
os.unlink(name)
def test_load_from_file(self):
- lexer_file = os.path.join(TESTDIR, 'support', 'python_lexer.py')
- formatter_file = os.path.join(TESTDIR, 'support', 'html_formatter.py')
+ lexer_file = os.path.join('tests', 'support', 'python_lexer.py')
+ formatter_file = os.path.join('tests', 'support', 'html_formatter.py')
# By default, use CustomLexer
o = self.check_success('-l', lexer_file, '-f', 'html',
@@ -143,7 +142,7 @@ class CmdLineTest(unittest.TestCase):
def test_h_opt(self):
o = self.check_success('-h')
@ -55,7 +82,7 @@ Index: Pygments-2.3.1/tests/test_cmdline.py
def test_L_opt(self):
o = self.check_success('-L')
@@ -157,37 +157,37 @@ class CmdLineTest(unittest.TestCase):
@@ -157,37 +156,37 @@ class CmdLineTest(unittest.TestCase):
filename = TESTFILE
o = self.check_success('-Ofull=1,linenos=true,foo=bar',
'-fhtml', filename)
@ -103,7 +130,7 @@ Index: Pygments-2.3.1/tests/test_cmdline.py
def test_S_opt(self):
o = self.check_success('-S', 'default', '-f', 'html', '-O', 'linenos=1')
@@ -196,11 +196,11 @@ class CmdLineTest(unittest.TestCase):
@@ -196,11 +195,11 @@ class CmdLineTest(unittest.TestCase):
# every line is for a token class
parts = line.split()
self.assertTrue(parts[0].startswith('.'))
@ -119,12 +146,11 @@ Index: Pygments-2.3.1/tests/test_cmdline.py
self.check_failure('-S', 'default', '-f', 'foobar')
def test_N_opt(self):
@@ -228,68 +228,69 @@ class CmdLineTest(unittest.TestCase):
@@ -228,68 +227,68 @@ class CmdLineTest(unittest.TestCase):
self.check_failure(*opts, code=2)
def test_errors(self):
+ this_file_dir = os.path.dirname(os.path.realpath(__file__))
+ empty_file = os.path.join(this_file_dir, 'support/empty.py')
+ empty_file = os.path.join('tests', 'support', 'empty.py')
+
# input file not found
e = self.check_failure('-lpython', 'nonexistent.py')
@ -209,9 +235,84 @@ Index: Pygments-2.3.1/tests/test_cmdline.py
# same with -v: should reraise the exception
try:
Index: Pygments-2.3.1/tests/__init__.py
===================================================================
--- /dev/null
+++ Pygments-2.3.1/tests/__init__.py
+++ b/tests/__init__.py
@@ -0,0 +1 @@
+
--- a/tests/test_basic_api.py
+++ b/tests/test_basic_api.py
@@ -18,7 +18,7 @@ from pygments.lexer import RegexLexer
from pygments.formatters.img import FontNotFound
from pygments.util import text_type, StringIO, BytesIO, xrange, ClassNotFound
-import support
+from . import support
TESTFILE, TESTDIR = support.location(__file__)
--- a/tests/test_examplefiles.py
+++ b/tests/test_examplefiles.py
@@ -18,7 +18,7 @@ from pygments.lexers import get_lexer_fo
from pygments.token import Error
from pygments.util import ClassNotFound
-import support
+from . import support
STORE_OUTPUT = False
--- a/tests/test_html_formatter.py
+++ b/tests/test_html_formatter.py
@@ -21,7 +21,7 @@ from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter, NullFormatter
from pygments.formatters.html import escape_html
-import support
+from . import support
TESTFILE, TESTDIR = support.location(__file__)
--- a/tests/test_irc_formatter.py
+++ b/tests/test_irc_formatter.py
@@ -16,7 +16,7 @@ from pygments.util import StringIO
from pygments.lexers import PythonLexer
from pygments.formatters import IRCFormatter
-import support
+from . import support
tokensource = list(PythonLexer().get_tokens("lambda x: 123"))
--- a/tests/test_latex_formatter.py
+++ b/tests/test_latex_formatter.py
@@ -16,7 +16,7 @@ import tempfile
from pygments.formatters import LatexFormatter
from pygments.lexers import PythonLexer
-import support
+from . import support
TESTFILE, TESTDIR = support.location(__file__)
--- a/tests/test_rtf_formatter.py
+++ b/tests/test_rtf_formatter.py
@@ -8,7 +8,7 @@
"""
import unittest
-from string_asserts import StringTests
+from .string_asserts import StringTests
from pygments.util import StringIO
from pygments.formatters import RtfFormatter
--- a/tests/test_string_asserts.py
+++ b/tests/test_string_asserts.py
@@ -8,7 +8,7 @@
"""
import unittest
-from string_asserts import StringTests
+from .string_asserts import StringTests
class TestStringTests(StringTests, unittest.TestCase):

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 1 21:23:26 CEST 2019 - Matej Cepl <mcepl@suse.com>
- Refresh denose.patch to make whole test suite to pass.
bt#birkenfeld/pygments-main#1490
-------------------------------------------------------------------
Mon Feb 11 17:51:51 UTC 2019 - Jan Engelhardt <jengelh@inai.de>

View File

@ -25,6 +25,7 @@ License: BSD-2-Clause
Group: Development/Languages/Python
URL: http://pygments.org
Source: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz
# bt#birkenfeld/pygments-main#1490
Patch1: denose.patch
# We need pytest just because of its test runner, it seems even
# python3 stdlib unittest runner doesn't work