diff --git a/src/tests/runner.py b/src/tests/runner.py index f453ef1..2cf96f2 100755 --- a/src/tests/runner.py +++ b/src/tests/runner.py @@ -21,6 +21,8 @@ __license__ = """ import unittest2 import user_tests +import singleton_tests runner = unittest2.TextTestRunner() runner.run(user_tests.suite()) +runner.run(singleton_tests.suite()) diff --git a/src/tests/singleton_tests.py b/src/tests/singleton_tests.py new file mode 100755 index 0000000..db0dc67 --- /dev/null +++ b/src/tests/singleton_tests.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +""" + singletonTests - Singleton class test case +""" +__author__ = "Tassia Camoes Araujo " +__copyright__ = "Copyright (C) 2011 Tassia Camoes Araujo" +__license__ = """ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import unittest2 +import sys +sys.path.insert(0,'../') +from singleton import Singleton + +def suite(): + return unittest2.TestLoader().loadTestsFromTestCase(SingletonTests) + +class SingletonTests(unittest2.TestCase): + def test_creation(self): + object_1 = Singleton() + object_2 = Singleton() + self.assertEqual(id(object_1),id(object_2)) + +if __name__ == '__main__': + unittest2.main() diff --git a/src/tests/user_tests.py b/src/tests/user_tests.py index 70611c5..7c6d4a2 100755 --- a/src/tests/user_tests.py +++ b/src/tests/user_tests.py @@ -28,7 +28,6 @@ sys.path.insert(0,'../') from user import * from config import * from data import * -from pxi import * def suite(): return unittest2.TestLoader().loadTestsFromTestCase(UserTests) @@ -39,7 +38,7 @@ class UserTests(unittest2.TestCase): cfg = Config() #self.axi = xapian.Database(cfg.axi) self.user = User({"gimp":1,"aaphoto":1,"eog":1,"emacs":1}) - self.pxi = PkgXapianIndex() + self.pxi = PkgXapianIndex("package-xapian-index") def test_hash(self): new_user = User(dict()) -- libgit2 0.21.2