From 41381df6a55bf5e073a7fe445e070b3d59f34f4a Mon Sep 17 00:00:00 2001 From: Danylo Kuropiatnyk Date: Wed, 17 Feb 2021 15:03:50 +0200 Subject: [PATCH] LU-2202: Start unittests during installation or build of pungi * added section with tests and pytest module to requires IMPORTANT - build.sh script is commented * added pyfakefs dependency * fixed little mock_open issue for runroot test * bumped version @BS-TARGET-CL8 Change-Id: I036db225646875eb610736cd26f473850a78447c --- pungi.spec | 14 +++++++++++--- pungi/runroot.py | 2 +- setup.py | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pungi.spec b/pungi.spec index 0a761ff7..023ab245 100644 --- a/pungi.spec +++ b/pungi.spec @@ -1,7 +1,7 @@ %{?python_enable_dependency_generator} Name: pungi -Version: 4.2.9 +Version: 4.2.10 Release: 1%{?dist}.cloudlinux Summary: Distribution compose tool @@ -10,7 +10,10 @@ URL: https://pagure.io/pungi Source0: %{name}-%{version}.tar.bz2 BuildRequires: python3-nose +BuildRequires: python3-pytest BuildRequires: python3-mock +BuildRequires: python3-pyfakefs +BuildRequires: python3-ddt BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-productmd >= 1.23 @@ -115,8 +118,12 @@ rm %{buildroot}%{_bindir}/pungi # CLOUDLINUX: We don't need fedmsg stuff rm %{buildroot}%{_bindir}/%{name}-fedmsg-notification -#%check -#nosetests-3 --exe +%check +python3 -m pytest +# master branch part of %check segment. Currently it doesn't work +# because of pungi-koji requirement in bash tests +#./tests/data/specs/build.sh +#cd tests && ./test_compose.sh %files %license COPYING GPL @@ -150,6 +157,7 @@ rm %{buildroot}%{_bindir}/%{name}-fedmsg-notification %{_bindir}/%{name}-compare-depsolving %{_bindir}/%{name}-wait-for-signed-ostree-handler + %changelog * Thu Feb 11 2021 Stepan Oksanichenko - 4.2.9-1 - LNX-133: Create a server for building nightly builds of AlmaLinux diff --git a/pungi/runroot.py b/pungi/runroot.py index f119b59a..9e5929d6 100644 --- a/pungi/runroot.py +++ b/pungi/runroot.py @@ -93,7 +93,7 @@ class Runroot(kobo.log.LoggingBase): log_file = os.path.join(log_dir, "program.log") try: with open(log_file) as f: - for line in f: + for line in f.readlines(): if "losetup: cannot find an unused loop device" in line: return True if re.match("losetup: .* failed to set up loop device", line): diff --git a/setup.py b/setup.py index 4a15d771..99116d0f 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ packages = sorted(packages) setup( name="pungi", - version="4.2.9", + version="4.2.10", description="Distribution compose tool", url="https://pagure.io/pungi", author="Dennis Gilmore",