test_pwman.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env python
  2. #============================================================================
  3. # This file is part of Pwman3.
  4. #
  5. # Pwman3 is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License, version 2
  7. # as published by the Free Software Foundation;
  8. #
  9. # Pwman3 is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with Pwman3; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. #============================================================================
  18. # Copyright (C) 2013 Oz Nahum <nahumoz@gmail.com>
  19. #============================================================================
  20. import os
  21. import sys
  22. import unittest
  23. from .test_crypto_engine import CryptoEngineTest, TestPassGenerator
  24. from .test_config import TestConfig
  25. from .test_sqlite import TestSQLite
  26. from .test_importer import TestImporter
  27. from .test_factory import TestFactory
  28. from .test_base_ui import TestBaseUI
  29. from .test_init import TestInit
  30. from .test_nodes import TestNode
  31. if 'win' not in sys.platform:
  32. from .test_complete_ui import (Ferrum, NEW_DB_PATH)
  33. if os.path.exists(NEW_DB_PATH):
  34. os.remove(NEW_DB_PATH)
  35. # make sure we use local pwman
  36. sys.path.insert(0, os.getcwd())
  37. # check if old DB exists, if so remove it.
  38. # excuted only once when invoked upon import or
  39. # upon run
  40. # SetupTester().clean()
  41. def suite():
  42. loader = unittest.TestLoader()
  43. suite = unittest.TestSuite()
  44. suite.addTest(loader.loadTestsFromTestCase(CryptoEngineTest))
  45. suite.addTest(loader.loadTestsFromTestCase(TestPassGenerator))
  46. suite.addTest(loader.loadTestsFromTestCase(TestConfig))
  47. suite.addTest(loader.loadTestsFromTestCase(TestSQLite))
  48. suite.addTest(loader.loadTestsFromTestCase(TestImporter))
  49. suite.addTest(loader.loadTestsFromTestCase(TestFactory))
  50. suite.addTest(loader.loadTestsFromTestCase(TestBaseUI))
  51. suite.addTest(loader.loadTestsFromTestCase(TestInit))
  52. suite.addTest(loader.loadTestsFromTestCase(TestNode))
  53. #if 'win' not in sys.platform:
  54. # suite.addTest(loader.loadTestsFromTestCase(Ferrum))
  55. return suite
  56. if __name__ == '__main__':
  57. try:
  58. unittest.TextTestRunner(verbosity=2, failfast=True).run(suite())
  59. except SystemExit:
  60. TestConfig.clean_all()
  61. TestBaseUI.clean_all()
  62. TestImporter.clean_all()