diff --git a/disable-online-tests.patch b/disable-online-tests.patch new file mode 100644 index 0000000..dc4d407 --- /dev/null +++ b/disable-online-tests.patch @@ -0,0 +1,38 @@ +Index: css-parser-1.0.4/css_parser_tests/test_errorhandler.py +=================================================================== +--- css-parser-1.0.4.orig/css_parser_tests/test_errorhandler.py ++++ css-parser-1.0.4/css_parser_tests/test_errorhandler.py +@@ -99,13 +99,6 @@ class ErrorHandlerTestCase(basetest.Base + self.assertEqual(s.getvalue(), + 'ERROR Property: Invalid value for "CSS Level 2.1" property: 1 [1:5: color]\n') + +- s = self._setHandler() +- +- css_parser.log.setLevel(logging.ERROR) +- css_parser.parseUrl('http://example.com') +- self.assertEqual(s.getvalue()[:38], +- 'ERROR Expected "text/css" mime type') +- + def test_parsevalidation(self): + style = 'color: 1' + t = 'a { %s }' % style +Index: css-parser-1.0.4/css_parser_tests/test_parse.py +=================================================================== +--- css-parser-1.0.4.orig/css_parser_tests/test_parse.py ++++ css-parser-1.0.4/css_parser_tests/test_parse.py +@@ -4,6 +4,7 @@ from __future__ import absolute_import, + + import sys + import xml.dom ++import unittest + + import css_parser + +@@ -83,6 +84,7 @@ class CSSParserTestCase(basetest.BaseTes + p.parseString(css).cssText, + '/*1*/\na {\n color: /*2*/ red\n }'.encode()) + ++ @unittest.skip('online test') + def test_parseUrl(self): + "CSSParser.parseUrl()" + parser = css_parser.CSSParser() diff --git a/python-css-parser.changes b/python-css-parser.changes index 588aa72..d1e35d7 100644 --- a/python-css-parser.changes +++ b/python-css-parser.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Jan 7 10:31:43 UTC 2019 - Tomáš Chvátal + +- Enable tests +- Add patch to disable online tests: + * disable-online-tests.patch + ------------------------------------------------------------------- Sat Jan 5 11:55:32 UTC 2019 - ecsos@opensuse.org diff --git a/python-css-parser.spec b/python-css-parser.spec index 3c0845b..a2c58f9 100644 --- a/python-css-parser.spec +++ b/python-css-parser.spec @@ -1,7 +1,7 @@ # # spec file for package python-css-parser # -# 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 @@ -17,28 +17,25 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define oldpython python - -Name: python-css-parser -Version: 1.0.4 -Release: 0 -Summary: CSS related utilities (parsing, serialization, etc) for python -License: LGPL-3.0-or-later -Group: Development/Languages/Python -URL: https://github.com/ebook-utils/css-parser -Source: https://github.com/ebook-utils/css-parser/archive/v%{version}/%{name}-%{version}.tar.gz -BuildRequires: %{python_module setuptools} -BuildRequires: python-rpm-macros -BuildRequires: fdupes -BuildArch: noarch -%ifpython2 -Provides: %{oldpython}-css-parser-doc = %{version} -Obsoletes: %{oldpython}-css-parser-doc < %{version} -%endif +Name: python-css-parser +Version: 1.0.4 +Release: 0 +Summary: CSS related utilities (parsing, serialization, etc) for python +License: LGPL-3.0-or-later +Group: Development/Languages/Python +URL: https://github.com/ebook-utils/css-parser +Source: https://github.com/ebook-utils/css-parser/archive/v%{version}/%{name}-%{version}.tar.gz +Patch0: disable-online-tests.patch +BuildRequires: %{python_module chardet} +BuildRequires: %{python_module setuptools} +Requires: python-chardet +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch %python_subpackages %description -CSS related utilities (parsing, serialization, etc) for python +CSS related utilities (parsing, serialization, etc) for python A fork of the cssutils project based on version 1.0.2. This fork includes general bug fixes and extensions specific to editing and working with ebooks. @@ -47,6 +44,7 @@ The main python source code has been modified so that it will run without furthe %prep %setup -q -n css-parser-%{version} sed -i "1d" src/css_parser/{parse,codec,sac,serialize,scripts/csscapture,_codec2,errorhandler,scripts/cssparse,_codec3,scripts/csscombine,tokenize2,version,encutils/__init__,__init__}.py # Fix non-executable scripts +%patch0 -p1 %build %python_build @@ -56,6 +54,9 @@ sed -i "1d" src/css_parser/{parse,codec,sac,serialize,scripts/csscapture,_codec2 # replace duplicate .pyo/.pyc with hardlinks %fdupes %{buildroot}/%{python_sitelib}/css_parser/ +%check +%python_exec setup.py test + %files %{python_files} %license COPYING COPYING.LESSER %doc README.md