add test script and configuration

This commit is contained in:
Gerd Hoffmann 2023-05-25 14:53:45 +02:00
parent 56ca92b3d9
commit 6a1bed53d9
3 changed files with 34 additions and 1 deletions

15
pefile-tests.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# config
COMMIT="64524fa8a041"
REMOTE="https://github.com/erocarrera/pefile-tests"
# clone repo and run tests
TESTDIR="$(mktemp --directory ${TMPDIR-/var/tmp}/test-XXXXXXXX)"
trap 'cd /; rm -rf "$TESTDIR"' EXIT
cd "$TESTDIR"
set -ex
git clone $REMOTE repo
cd repo
git checkout "$COMMIT"
pytest tests/pefile_test.py

View File

@ -4,12 +4,13 @@
Name: python-%{pypi_name}
Version: %{pypi_version}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Python PE parsing module
License: MIT
URL: https://github.com/erocarrera/pefile
Source0: %{pypi_name}-%{pypi_version}.tar.gz
Source1: pefile-tests.sh
BuildArch: noarch
BuildRequires: python3-devel
@ -39,6 +40,8 @@ rm -rf %{pypi_name}.egg-info
%install
%py3_install
mkdir -p %{buildroot}%{_datadir}/%{name}
cp %{SOURCE1} %{buildroot}%{_datadir}/%{name}
%files -n python3-%{pypi_name}
%license LICENSE
@ -47,7 +50,11 @@ rm -rf %{pypi_name}.egg-info
%{python3_sitelib}/ordlookup
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}-%{pypi_version}-py%{python3_version}.egg-info
%{_datadir}/%{name}
%changelog
* Thu May 25 2023 Gerd Hoffmann <kraxel@redhat.com> - 2023.2.7-2
- Added test script and configuration.
* Tue May 23 2023 Gerd Hoffmann <kraxel@redhat.com> - 2023.2.7-1
- Initial package.

11
tests/tests.yml Normal file
View File

@ -0,0 +1,11 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- git-core
- pytest
tests:
- pefile-tests:
run: /usr/share/python-pefile/pefile-tests.sh