Move python test-suite macros to local.at, rename
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 16 Dec 2010 15:18:21 +0000 (17:18 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 16 Dec 2010 15:18:21 +0000 (17:18 +0200)
- We'll want to use these in other test parts than just python. Make
  available everywhere and use "namespace" to avoid potential future
  clashes.

tests/local.at
tests/rpmpython.at

index 5808596..64564cb 100644 (file)
@@ -10,5 +10,21 @@ m4_define([RPMDB_CLEAR],[[
 rm -rf "${abs_builddir}"/testing`run rpm --eval '%_dbpath'`/*
 ]])
 
+m4_define([RPMPY_RUN],[
+cat << EOF > test.py
+import rpm, sys
+def myprint(msg):
+    sys.stdout.write('%s\n' % msg)
+$1
+EOF
+python test.py
+])
+
+m4_define([RPMPY_CHECK],[
+AT_SETUP([$1])
+AT_KEYWORDS([python])
+AT_CHECK([RPMPY_RUN([[$2]])], [], [$3], [$4])
+AT_CLEANUP
+])
 
 AT_INIT
index 8651ca5..e314615 100644 (file)
@@ -3,30 +3,13 @@
 
 AT_BANNER([Python bindings])
 
-m4_define([RUNPY],[
-cat << EOF > test.py
-import rpm, sys
-def myprint(msg):
-    sys.stdout.write('%s\n' % msg)
-$1
-EOF
-python test.py
-])
-
-m4_define([PY_CHECK],[
-AT_SETUP([$1])
-AT_KEYWORDS([python])
-AT_CHECK([RUNPY([[$2]])], [], [$3], [$4])
-AT_CLEANUP
-])
-
-PY_CHECK([module import],[
+RPMPY_CHECK([module import],[
 myprint(rpm.__version__)
 ],
 [AT_PACKAGE_VERSION]
 )
 
-PY_CHECK([basic header manipulation],[
+RPMPY_CHECK([basic header manipulation],[
 h = rpm.hdr()
 h['name'] = 'testpkg'
 h['version'] = '1.0'
@@ -41,7 +24,7 @@ myprint(h['nevra'])
 testpkg-1.0-1.noarch]
 )
 
-PY_CHECK([reading a package file],[
+RPMPY_CHECK([reading a package file],[
 ts = rpm.ts()
 h = ts.hdrFromFdno('${RPMDATA}/RPMS/hello-1.0-1.ppc64.rpm')
 myprint(h['arch'])
@@ -49,7 +32,7 @@ myprint(h['arch'])
 [ppc64]
 )
 
-PY_CHECK([add package to transaction],[
+RPMPY_CHECK([add package to transaction],[
 ts = rpm.ts()
 ts.addInstall('${RPMDATA}/RPMS/foo-1.0-1.noarch.rpm', 'u')
 for e in ts: