More work on test script.

This commit is contained in:
Devan Goodwin 2009-07-20 23:59:28 -03:00
parent 333b28663b
commit f7ed5d3e1e

View file

@ -4,9 +4,13 @@ import sys
import os import os
import os.path import os.path
# Python libraries are one level up from where this script lives: import unittest
# Make sure we run from the source code and not a version of tito
# installed on the system:
TEST_SCRIPT_DIR = os.path.dirname(sys.argv[0]) TEST_SCRIPT_DIR = os.path.dirname(sys.argv[0])
sys.path.append(os.path.join(TEST_SCRIPT_DIR, "../src/")) sys.path.append(os.path.join(TEST_SCRIPT_DIR, "../src/"))
SRC_SCRIPT_DIR = sys.path.append(os.path.join(TEST_SCRIPT_DIR, "../bin/"))
import spacewalk.releng.cli # prevents a circular import import spacewalk.releng.cli # prevents a circular import
from spacewalk.releng.common import * from spacewalk.releng.common import *
@ -15,6 +19,17 @@ from spacewalk.releng.common import *
# WARNING: This location will be destroyed if present. # WARNING: This location will be destroyed if present.
TEST_GIT_LOCATION = '/tmp/tito-test-git-repo' TEST_GIT_LOCATION = '/tmp/tito-test-git-repo'
def tito(argstring):
""" Run the tito script from source with given arguments. """
run_command("%s/%s %s" % (SRC_SCRIPT_DIR, 'tito', argstring))
class InitTests(unittest.TestCase):
def test_something(self):
pass
if __name__ == '__main__': if __name__ == '__main__':
print "Running tito tests." print "Running tito tests."
@ -34,4 +49,12 @@ if __name__ == '__main__':
run_command('git add c.txt') run_command('git add c.txt')
run_command('git commit -a -m "added c.txt"') run_command('git commit -a -m "added c.txt"')
# Now run the tests, order is important:
suite = unittest.makeSuite(InitTests)
result = unittest.TestResult()
suite.run(result)
print result.errors
print result.failures
print result.wasSuccessful()