Run tests, add py_provides for f32

This commit is contained in:
Davide Cavalca 2020-10-30 10:21:36 -07:00
commit c907d1dea2
2 changed files with 62 additions and 1 deletions

View file

@ -1,18 +1,28 @@
%bcond_without tests
%global pypi_name sphinx-kr-theme
Name: python-%{pypi_name}
Version: 0.2.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Kenneth Reitz's krTheme for Sphinx
License: BSD
URL: https://github.com/tonyseek/sphinx-kr-theme
Source0: %{pypi_source}
%if %{with tests}
# Tests are not included in the PyPI tarball
Source1: https://raw.githubusercontent.com/tonyseek/sphinx-kr-theme/57834e237e35b59b5957aacb7ac072e434dd5e93/tests.py
%endif
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
%if %{with tests}
BuildRequires: python3dist(pytest)
%endif
%description
This is a repackaging of Kenneth Reitz's krTheme, a theme for use in
Sphinx documentation, originally derived from Mitsuhiko's Flask theme.
@ -21,6 +31,10 @@ Sphinx documentation, originally derived from Mitsuhiko's Flask theme.
Summary: %{summary}
Requires: python3dist(setuptools)
%if 0%{?fedora} < 33 || 0%{?rhel} < 9
%py_provides python3-%{pypi_name}
%endif
%description -n python3-%{pypi_name}
This is a repackaging of Kenneth Reitz's krTheme, a theme for use in
Sphinx documentation, originally derived from Mitsuhiko's Flask theme.
@ -33,6 +47,12 @@ rm -rf %{pypi_name}.egg-info
%build
%py3_build
%if %{with tests}
%check
export PYTHONPATH=%{buildroot}%{python3_sitelib}
%pytest %{SOURCE1}
%endif
%install
%py3_install
@ -43,6 +63,10 @@ rm -rf %{pypi_name}.egg-info
%{python3_sitelib}/sphinx_kr_theme-%{version}-py%{python3_version}.egg-info
%changelog
* Fri Oct 30 2020 Davide Cavalca <dcavalca@fedoraproject.org> - 0.2.1-3
- Add py_provides for F32
- Run tests
* Wed Oct 28 2020 Davide Cavalca <dcavalca@fedoraproject.org> - 0.2.1-2
- Use pypi_source
- Fix license

37
tests.py Normal file
View file

@ -0,0 +1,37 @@
import os
from pytest import fixture
from sphinx_kr_theme import get_html_theme_path
@fixture
def html_theme_path():
return get_html_theme_path()
def test_path(html_theme_path):
assert html_theme_path.endswith('sphinx_kr_theme')
assert {'kr', 'kr_small'}.issubset(set(os.listdir(html_theme_path)))
def test_files(html_theme_path):
kr_files = set(os.listdir(os.path.join(html_theme_path, 'kr')))
kr_small_files = set(os.listdir(os.path.join(html_theme_path, 'kr_small')))
required_files = {'static', 'layout.html', 'theme.conf'}
assert required_files.issubset(kr_files)
assert required_files.issubset(kr_small_files)
def test_static_files():
kr_static = os.path.join(get_html_theme_path(), 'kr/static')
kr_small_static = os.path.join(get_html_theme_path(), 'kr_small/static')
kr_static_files = map(os.path.splitext, os.listdir(kr_static))
kr_small_static_files = map(os.path.splitext, os.listdir(kr_small_static))
kr_static_exts = {ext for _, ext in kr_static_files}
kr_small_static_exts = {ext for _, ext in kr_small_static_files}
assert kr_static_exts == {'.css', '.css_t'}
assert kr_small_static_exts == {'.css_t'}