Re-enable functional tests, add top level runtests.py.

Path hacks currently requiring this, though we still use python-nose
once it's time to actually call the tests. Still probably a solution to
get rid of the test script...
This commit is contained in:
Devan Goodwin 2009-07-25 11:50:02 -03:00
parent e5e98bc098
commit 6ea3f432bc
4 changed files with 50 additions and 2 deletions

43
runtests.py Normal file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env python
#
# Copyright (c) 2008-2009 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
"""
Executes all tests.
"""
import sys
import os
import os.path
import unittest
# Make sure we run from the source, this is tricky because the functional
# tests need to find both the location of the 'tito' executable script,
# and the internal tito code needs to know where to find our auxiliary Perl
# scripts. Adding an environment variable hack to the actual code to
# accommodate this for now.
TEST_SCRIPT_DIR = os.path.abspath(os.path.dirname(sys.argv[0]))
SRC_DIR = os.path.normpath(os.path.join(TEST_SCRIPT_DIR, "src/"))
SRC_BIN_DIR = os.path.abspath(os.path.join(TEST_SCRIPT_DIR, "bin/"))
os.environ['TITO_SRC_DIR'] = SRC_DIR
os.environ['TITO_SRC_BIN_DIR'] = SRC_BIN_DIR
if __name__ == '__main__':
print("Running tito tests.")
import nose
nose.main()

View file

@ -52,6 +52,7 @@ setup(
'Intended Audience :: Information Technology', 'Intended Audience :: Information Technology',
'Programming Language :: Python' 'Programming Language :: Python'
], ],
# test_suite = 'nose.collector',
) )

View file

View file

@ -66,8 +66,8 @@ rm -rf %{buildroot}
def tito(argstring): def tito(argstring):
""" Run the tito script from source with given arguments. """ """ Run the tito script from source with given arguments. """
print sys.argv[0] bin_dir = os.environ['TITO_SRC_BIN_DIR']
run_command("%s %s" % ('tito', argstring)) run_command("%s %s" % (os.path.join(bin_dir, 'tito'), argstring))
def cleanup_test_git_repos(): def cleanup_test_git_repos():
""" Delete the test directory if it exists. """ """ Delete the test directory if it exists. """
@ -117,6 +117,10 @@ class TaggerTests(unittest.TestCase):
self.assertTrue(os.path.exists(os.path.join(SINGLE_GIT, "rel-eng", self.assertTrue(os.path.exists(os.path.join(SINGLE_GIT, "rel-eng",
"tito.props"))) "tito.props")))
def tearDown(self):
os.chdir('/tmp') # anywhere but the git repo were about to delete
cleanup_test_git_repos()
def test_tag_new_package(self): def test_tag_new_package(self):
#tito("tag") #tito("tag")
pass pass