From 5cc03e7ae806295fe827f3d5e395f1ef9188c9f5fae374c82c82dd4be04d1a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 8 Mar 2019 15:23:34 +0000 Subject: [PATCH] - Add patch to make tests pass: * tests.patch - Enable tests OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-webassets?expand=0&rev=2 --- python-webassets.changes | 7 ++++++ python-webassets.spec | 27 ++++++++++++++--------- tests.patch | 46 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 tests.patch diff --git a/python-webassets.changes b/python-webassets.changes index 446f484..afa5120 100644 --- a/python-webassets.changes +++ b/python-webassets.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Mar 8 15:15:52 UTC 2019 - Tomáš Chvátal + +- Add patch to make tests pass: + * tests.patch +- Enable tests + ------------------------------------------------------------------- Mon Dec 4 17:38:02 UTC 2017 - 9@cirno.systems diff --git a/python-webassets.spec b/python-webassets.spec index dedf461..12892de 100644 --- a/python-webassets.spec +++ b/python-webassets.spec @@ -1,7 +1,7 @@ # # spec file for package python-webassets # -# Copyright (c) 2017 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 @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -25,15 +25,18 @@ Summary: Media asset management for Python, with glue code for various we # jspacker=LGPL-2.1 # cssrewrite=BSD-3-Clause # six.py=MIT -License: BSD-2-Clause AND Apache-2.0 AND LGPL-2.1 AND BSD-3-Clause AND MIT +License: BSD-2-Clause AND Apache-2.0 AND LGPL-2.1-only AND BSD-3-Clause AND MIT Group: Development/Languages/Python -Url: http://github.com/miracle2k/webassets/ +URL: http://github.com/miracle2k/webassets/ Source: https://files.pythonhosted.org/packages/source/w/webassets/webassets-%{version}.tar.gz -BuildRequires: %{python_module devel} +Patch0: tests.patch +BuildRequires: %{python_module mock} +BuildRequires: %{python_module nose} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes -BuildRequires: help2man BuildRequires: python-rpm-macros +Requires: python-setuptools BuildArch: noarch %python_subpackages @@ -44,21 +47,25 @@ URL rewriting in CSS files. %prep %setup -q -n webassets-%{version} +%patch0 -p1 sed -i 's/#!.*//' src/webassets/filter/rjsmin/rjsmin.py +# fix py2 only syntax +sed -i -e 's:e.message:e.args[0]:g' tests/test_filters.py %build %python_build %install %python_install -install -d 755 %{buildroot}%{_mandir}/man1 -%{python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} help2man -o %{buildroot}%{_mandir}/man1/webassets.1 -n webassets --version-string=%{version} -N "$python %{buildroot}%{_bindir}/webassets"} %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%{pytest} + %files %{python_files} -%doc AUTHORS CHANGES LICENSE README.rst +%license LICENSE +%doc AUTHORS CHANGES README.rst %python3_only %{_bindir}/webassets -%python3_only %{_mandir}/man1/webassets.1%{ext_man} %{python_sitelib}/* %changelog diff --git a/tests.patch b/tests.patch new file mode 100644 index 0000000..82f2e7f --- /dev/null +++ b/tests.patch @@ -0,0 +1,46 @@ +From 8b12f8194120e32775e16c2856a8776d93295082 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= +Date: Fri, 8 Mar 2019 16:15:17 +0100 +Subject: [PATCH] Skip tests where we didn't find the binaries + +skip tests if we didn't find babel or postcss node binaries allowing us to pass testsuite without them present. +--- + tests/test_filters.py | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/tests/test_filters.py b/tests/test_filters.py +index 75325a61..3ffdb563 100644 +--- a/tests/test_filters.py ++++ b/tests/test_filters.py +@@ -1522,7 +1522,14 @@ class TestAutoprefixer6Filter(TempEnvironmentHelper): + } + + def test_first(self): +- self.mkbundle('test.css', filters='autoprefixer6', output='output.css').build() ++ try: ++ self.mkbundle('test.css', filters='autoprefixer6', output='output.css').build() ++ except FilterError as e: ++ # postcss is not installed, that's ok. ++ if 'Program file not found' in e.message: ++ raise SkipTest() ++ else: ++ raise + out = self.get('output.css') + assert 'webkit' in out + +@@ -1546,7 +1553,14 @@ def test_es2015(self): + + def test_extra_args(self): + self.env.config['BABEL_EXTRA_ARGS'] = ['--minified'] +- self.mkbundle('test.es6', filters='babel', output='output.js').build() ++ try: ++ self.mkbundle('test.es6', filters='babel', output='output.js').build() ++ except FilterError as e: ++ # babel is not installed, that's ok. ++ if 'Program file not found' in e.message: ++ raise SkipTest() ++ else: ++ raise + assert (self.get('output.js').strip() == + 'var x=p=>{return false};') +