summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-06-09 13:19:14 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-06-09 13:19:14 +0300
commit9ba42047d8a35c22c7f6e0d40ee6b468f17803c0 (patch)
treeafc783e5ba7730b4c01ed1181bf7456f4cb7b2c8 /tests
parent211bc3d356ccbbc2b1026015d32e21986f6a95b0 (diff)
downloadrpm-9ba42047d8a35c22c7f6e0d40ee6b468f17803c0.tar.gz
rpm-9ba42047d8a35c22c7f6e0d40ee6b468f17803c0.tar.bz2
rpm-9ba42047d8a35c22c7f6e0d40ee6b468f17803c0.zip
Rearrange test-suite python helper macros a bit
- Handle double [] "escaping" at RPM_PYRUN to avoid surprises when its used on its own - Spin python-wrapped AT_CHECK into a macro of its own (RPMPY_CHECK) - What formerly was RPMPY_CHECK is now RPMPY_TEST: this represents one entire testcase with all its setup and cleanup, whereas RPMPY_CHECK (the new one) might be used several times within a single test
Diffstat (limited to 'tests')
-rw-r--r--tests/local.at12
-rw-r--r--tests/rpmdepmatch.at2
-rw-r--r--tests/rpmpython.at8
3 files changed, 14 insertions, 8 deletions
diff --git a/tests/local.at b/tests/local.at
index 2ab131937..48c5d3f96 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -8,7 +8,7 @@ m4_define([RPMDB_CLEAR],[[
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')
@@ -18,12 +18,18 @@ def myprint(msg = ''):
$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
])
diff --git a/tests/rpmdepmatch.at b/tests/rpmdepmatch.at
index 3cef10436..855ca61e2 100644
--- a/tests/rpmdepmatch.at
+++ b/tests/rpmdepmatch.at
@@ -1,7 +1,7 @@
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
diff --git a/tests/rpmpython.at b/tests/rpmpython.at
index e314615a5..a2a545da3 100644
--- a/tests/rpmpython.at
+++ b/tests/rpmpython.at
@@ -3,13 +3,13 @@
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'
@@ -24,7 +24,7 @@ myprint(h['nevra'])
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'])
@@ -32,7 +32,7 @@ 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: