- new
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 5 Sep 2021 21:29:22 +0000 (23:29 +0200)
committerJan Rękorajski <baggins@pld-linux.org>
Sun, 5 Sep 2021 21:29:22 +0000 (23:29 +0200)
disable-flake8-isort-for-pytest.patch [new file with mode: 0644]
disable-missing-data-tests.patch [new file with mode: 0644]
python3-tinycss2.spec [new file with mode: 0644]

diff --git a/disable-flake8-isort-for-pytest.patch b/disable-flake8-isort-for-pytest.patch
new file mode 100644 (file)
index 0000000..d7a114b
--- /dev/null
@@ -0,0 +1,35 @@
+diff --git a/pyproject.toml b/pyproject.toml
+index 41535ed..30dbcd4 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -32,7 +32,7 @@ classifiers = [
+ [tool.flit.metadata.requires-extra]
+ doc = ['sphinx', 'sphinx_rtd_theme']
+-test = ['pytest', 'pytest-cov', 'pytest-flake8', 'pytest-isort', 'coverage[toml]']
++test = ['pytest', 'pytest-cov', 'coverage[toml]']
+ [tool.flit.metadata.urls]
+ Documentation = 'https://tinycss2.readthedocs.io/'
+@@ -44,7 +44,7 @@ Donation = 'https://opencollective.com/courtbouillon'
+ exclude = ['.*']
+ [tool.pytest.ini_options]
+-addopts = '--isort --flake8 --cov'
++addopts = '--cov'
+ norecursedirs = ['tests/css-parsing-tests']
+ [tool.coverage.run]
+diff --git a/setup.py b/setup.py
+index 8e8a09c..8901670 100644
+--- a/setup.py
++++ b/setup.py
+@@ -16,8 +16,6 @@ extras_require = \
+ {'doc': ['sphinx', 'sphinx_rtd_theme'],
+  'test': ['pytest',
+           'pytest-cov',
+-          'pytest-flake8',
+-          'pytest-isort',
+           'coverage[toml]']}
+ setup(name='tinycss2',
diff --git a/disable-missing-data-tests.patch b/disable-missing-data-tests.patch
new file mode 100644 (file)
index 0000000..667a461
--- /dev/null
@@ -0,0 +1,102 @@
+--- tinycss2-1.1.0/tests/test_tinycss2.py~     2020-10-08 09:28:34.000000000 +0200
++++ tinycss2-1.1.0/tests/test_tinycss2.py      2021-09-05 23:24:47.645579634 +0200
+@@ -80,99 +80,9 @@
+     return list(zip(json_data[::2], json_data[1::2]))
+-def json_test(filename=None):
+-    def decorator(function):
+-        filename_ = filename or function.__name__.split('_', 1)[-1] + '.json'
+-
+-        @pytest.mark.parametrize(('css', 'expected'), load_json(filename_))
+-        def test(css, expected):
+-            value = to_json(function(css))
+-            if value != expected:  # pragma: no cover
+-                pprint.pprint(value)
+-                assert value == expected
+-        return test
+-    return decorator
+-
+-
+ SKIP = dict(skip_comments=True, skip_whitespace=True)
+-@json_test()
+-def test_component_value_list(input):
+-    return parse_component_value_list(input, skip_comments=True)
+-
+-
+-@json_test()
+-def test_one_component_value(input):
+-    return parse_one_component_value(input, skip_comments=True)
+-
+-
+-@json_test()
+-def test_declaration_list(input):
+-    return parse_declaration_list(input, **SKIP)
+-
+-
+-@json_test()
+-def test_one_declaration(input):
+-    return parse_one_declaration(input, skip_comments=True)
+-
+-
+-@json_test()
+-def test_stylesheet(input):
+-    return parse_stylesheet(input, **SKIP)
+-
+-
+-@json_test()
+-def test_rule_list(input):
+-    return parse_rule_list(input, **SKIP)
+-
+-
+-@json_test()
+-def test_one_rule(input):
+-    return parse_one_rule(input, skip_comments=True)
+-
+-
+-@json_test()
+-def test_color3(input):
+-    return parse_color(input)
+-
+-
+-@json_test(filename='An+B.json')
+-def test_nth(input):
+-    return parse_nth(input)
+-
+-
+-# Do not use @pytest.mark.parametrize because it is slow with that many values.
+-def test_color3_hsl():
+-    for css, expected in load_json('color3_hsl.json'):
+-        assert to_json(parse_color(css)) == expected
+-
+-
+-def test_color3_keywords():
+-    for css, expected in load_json('color3_keywords.json'):
+-        result = parse_color(css)
+-        if result is not None:
+-            r, g, b, a = result
+-            result = [r * 255, g * 255, b * 255, a]
+-        assert result == expected
+-
+-
+-@json_test()
+-def test_stylesheet_bytes(kwargs):
+-    kwargs['css_bytes'] = kwargs['css_bytes'].encode('latin1')
+-    kwargs.pop('comment', None)
+-    if kwargs.get('environment_encoding'):
+-        kwargs['environment_encoding'] = lookup(kwargs['environment_encoding'])
+-    kwargs.update(SKIP)
+-    return parse_stylesheet_bytes(**kwargs)
+-
+-
+-@json_test(filename='component_value_list.json')
+-def test_serialization(css):
+-    parsed = parse_component_value_list(css, skip_comments=True)
+-    return parse_component_value_list(serialize(parsed), skip_comments=True)
+-
+-
+ def test_skip():
+     source = '''
+     /* foo */
diff --git a/python3-tinycss2.spec b/python3-tinycss2.spec
new file mode 100644 (file)
index 0000000..b742a1b
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Conditional build:
+%bcond_without tests   # unit tests
+
+Summary:       Low-level CSS parser for Python
+Name:          python3-tinycss2
+Version:       1.1.0
+Release:       2
+License:       BSD
+Source0:       https://files.pythonhosted.org/packages/source/t/tinycss2/tinycss2-%{version}.tar.gz
+# Source0-md5: 7caf513c4e87fc2449dcfbf407a8416f
+Patch0:                disable-flake8-isort-for-pytest.patch
+Patch1:                disable-missing-data-tests.patch
+URL:           https://pypi.python.org/pypi/tinycss2/
+# required to run the tests
+%if %{with tests}
+BuildRequires: python3-pytest
+BuildRequires: python3-pytest-cov
+BuildRequires: python3-pytest-runner
+BuildRequires: python3-setuptools
+BuildRequires: python3-webencodings >= 0.4
+%endif
+BuildArch:     noarch
+
+%description
+tinycss2 is a modern, low-level CSS parser for Python. tinycss2 is a
+rewrite of tinycss with a simpler API, based on the more recent CSS
+Syntax Level 3 specification.
+
+%prep
+%setup -n tinycss2-%{version}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%py3_build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%py3_install
+
+%if %{with tests}
+%{__python3} -m pytest -v
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README.rst
+%{py3_sitescriptdir}/tinycss2
+%{py3_sitescriptdir}/tinycss2-%{version}-py*.egg-info
This page took 0.082559 seconds and 4 git commands to generate.