rm -rf "${abs_builddir}"/testing`rpm --eval '%_dbpath'`/*
]])
-m4_define([RPMPY_RUN],[
+m4_define([RPMPY_RUN],[[
cat << EOF > test.py
import rpm, sys
dbpath=rpm.expandMacro('%_dbpath')
$1
EOF
python test.py
-])
+]])
m4_define([RPMPY_CHECK],[
+AT_CHECK([RPMPY_RUN([$1])], [], [$2], [$3])
+])
+
+m4_define([RPMPY_TEST],[
AT_SETUP([$1])
AT_KEYWORDS([python])
-AT_CHECK([RPMPY_RUN([[$2]])], [], [$3], [$4])
+RPMDB_CLEAR
+RPMDB_INIT
+RPMPY_CHECK([$2], [$3], [$4])
AT_CLEANUP
])
AT_BANNER([RPM dependency matching])
-RPMPY_CHECK([provide - require pairs],[
+RPMPY_TEST([provide - require pairs],[
# ((provides), (requires), match) expected values
tests = [
# Different names never match
AT_BANNER([Python bindings])
-RPMPY_CHECK([module import],[
+RPMPY_TEST([module import],[
myprint(rpm.__version__)
],
[AT_PACKAGE_VERSION]
)
-RPMPY_CHECK([basic header manipulation],[
+RPMPY_TEST([basic header manipulation],[
h = rpm.hdr()
h['name'] = 'testpkg'
h['version'] = '1.0'
testpkg-1.0-1.noarch]
)
-RPMPY_CHECK([reading a package file],[
+RPMPY_TEST([reading a package file],[
ts = rpm.ts()
h = ts.hdrFromFdno('${RPMDATA}/RPMS/hello-1.0-1.ppc64.rpm')
myprint(h['arch'])
[ppc64]
)
-RPMPY_CHECK([add package to transaction],[
+RPMPY_TEST([add package to transaction],[
ts = rpm.ts()
ts.addInstall('${RPMDATA}/RPMS/foo-1.0-1.noarch.rpm', 'u')
for e in ts: