14
0

- 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
This commit is contained in:
Tomáš Chvátal
2019-03-08 15:23:34 +00:00
committed by Git OBS Bridge
parent ccded4ccf1
commit 5cc03e7ae8
3 changed files with 70 additions and 10 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Mar 8 15:15:52 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to make tests pass:
* tests.patch
- Enable tests
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Dec 4 17:38:02 UTC 2017 - 9@cirno.systems Mon Dec 4 17:38:02 UTC 2017 - 9@cirno.systems

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-webassets # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # 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) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # 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 # jspacker=LGPL-2.1
# cssrewrite=BSD-3-Clause # cssrewrite=BSD-3-Clause
# six.py=MIT # 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 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 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: %{python_module setuptools}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: help2man
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-setuptools
BuildArch: noarch BuildArch: noarch
%python_subpackages %python_subpackages
@@ -44,21 +47,25 @@ URL rewriting in CSS files.
%prep %prep
%setup -q -n webassets-%{version} %setup -q -n webassets-%{version}
%patch0 -p1
sed -i 's/#!.*//' src/webassets/filter/rjsmin/rjsmin.py 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 %build
%python_build %python_build
%install %install
%python_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} %python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%{pytest}
%files %{python_files} %files %{python_files}
%doc AUTHORS CHANGES LICENSE README.rst %license LICENSE
%doc AUTHORS CHANGES README.rst
%python3_only %{_bindir}/webassets %python3_only %{_bindir}/webassets
%python3_only %{_mandir}/man1/webassets.1%{ext_man}
%{python_sitelib}/* %{python_sitelib}/*
%changelog %changelog

46
tests.patch Normal file
View File

@@ -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?= <tomas.chvatal@gmail.com>
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};')