Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to run test at build time #2574

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions package/python-kiwi-spec-template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
# If they aren't provided by a system installed macro, define them
%{!?_defaultdocdir: %global _defaultdocdir %{_datadir}/doc}

# Userland install of python modules such that new namespaces
# gets added to this environment properly. I did not find another
# way to install a python module as non root into this build environment
# such that importlib.* methods would find them. With the former
# pkg_resources this could be handled by setting the PYTHONPATH
# variable but this doesn't work anymore with importlib.
%global pip_install pip install --break-system-packages

%if 0%{?suse_version} && 0%{?suse_version} < 1600
%global __python3 /usr/bin/python3.11
%global python3_pkgversion 311
Expand Down Expand Up @@ -69,6 +77,14 @@ Source1: %{name}-rpmlintrc
## PATCH-FIX-OPENSUSE kiwi-revert-bls-default-for-suse.patch -- temporary until opensuse has bls
Patch1001: kiwi-revert-bls-default-for-suse.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: kiwi-systemdeps
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pip
%if 0%{?suse_version} > 1600
BuildRequires: python%{python3_pkgversion}-anymarkup-core
%endif
BuildRequires: python%{python3_pkgversion}-toml
BuildRequires: python%{python3_pkgversion}-xmltodict
%if 0%{?fedora} || 0%{?suse_version}
BuildRequires: fdupes
%endif
Expand Down Expand Up @@ -755,6 +771,13 @@ fi
%endif
%endif

%check
# install kiwi to userland and run the tests
%if 0%{?suse_version} > 1600
%pip_install dist/kiwi-%{version}-py3-none-any.whl
cd test/unit && pytest
%endif

%files -n kiwi-systemdeps-core
# Empty metapackage

Expand Down
Loading