- start of testing infrastructure
git-svn-id: svn+ssh://rpmlint.zarb.org/home/projects/rpmlint/svn/trunk@1224 9bc8b190-ac0f-0410-8968-dc7d1f502856
This commit is contained in:
parent
3246e8e236
commit
4599222baf
13
Filter.py
13
Filter.py
|
@ -9,6 +9,7 @@
|
|||
|
||||
import sys
|
||||
import Config
|
||||
import Testing
|
||||
|
||||
def printInfo(pkg, reason, *details):
|
||||
if _print("I", pkg, reason, details) and Config.info:
|
||||
|
@ -26,11 +27,13 @@ def _print(type, pkg, reason, details):
|
|||
s="%s: %s %s" % (type, pkg.name, reason)
|
||||
for d in details:
|
||||
s = s + " %s" % d
|
||||
|
||||
if not Config.isFiltered(s):
|
||||
sys.stdout.write(s)
|
||||
sys.stdout.write("\n")
|
||||
return 1
|
||||
if Testing.isTest():
|
||||
Testing.addOutput(s)
|
||||
else:
|
||||
if not Config.isFiltered(s):
|
||||
sys.stdout.write(s)
|
||||
sys.stdout.write("\n")
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
|
5
Makefile
5
Makefile
|
@ -51,6 +51,11 @@ install:
|
|||
verify:
|
||||
pychecker *.py
|
||||
|
||||
.PHONY: test
|
||||
|
||||
test:
|
||||
./test.sh
|
||||
|
||||
version:
|
||||
@echo "$(VERSION)"
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
import os
|
||||
import Pkg
|
||||
import glob
|
||||
|
||||
currently_testing = 0
|
||||
output = []
|
||||
|
||||
def isTest():
|
||||
return currently_testing
|
||||
|
||||
def startTest():
|
||||
global currently_testing
|
||||
global output
|
||||
output = []
|
||||
currently_testing = 1
|
||||
|
||||
def addOutput(s):
|
||||
global output
|
||||
output.append(s)
|
||||
|
||||
def getOutput():
|
||||
global output
|
||||
return output
|
||||
|
||||
def getTestedPackage(name):
|
||||
pkg_path = glob.glob(os.environ['TESTPATH'] + '/' + name + '-*.rpm')[0]
|
||||
return Pkg.Pkg(pkg_path, '/tmp')
|
|
@ -0,0 +1,9 @@
|
|||
export PYTHONPATH=$(pwd)
|
||||
export TESTPATH="$(pwd)/test/"
|
||||
for i in $TESTPATH/test.*.py; do
|
||||
echo $i
|
||||
python $i
|
||||
#if [ -n $? ]; then
|
||||
# exit $?
|
||||
#fi;
|
||||
done;
|
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
import unittest
|
||||
import Testing
|
||||
import PamCheck
|
||||
import Pkg
|
||||
# FIXME harcode
|
||||
|
||||
class TestPamCheck(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.pkg = Testing.getTestedPackage('PamCheck')
|
||||
Testing.startTest()
|
||||
def testcheck(self):
|
||||
PamCheck.check.check(self.pkg)
|
||||
self.assertEqual( Testing.getOutput(), ['E: PamCheck use-old-pam-stack /etc/pam.d/PamCheck'])
|
||||
|
||||
# enjoy \o/
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
#print Testing.getOutput()
|
Loading…
Reference in New Issue