test_pwman.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 .db_tests import (SetupTester)
  24. #, CLITests,
  25. #DBTests,
  26. # ConfigTest,
  27. # TestDBFalseConfig,
  28. #FactoryTest)
  29. #from .crypto_tests import CryptoTest
  30. from .test_crypto_engine import CryptoEngineTest
  31. from .test_config import TestConfig
  32. from .test_sqlite import TestSQLite
  33. from .test_importer import TestImporter
  34. from .test_factory import TestFactory
  35. from .test_base_ui import TestBaseUI
  36. from .test_init import TestInit
  37. if 'win' not in sys.platform:
  38. from .test_complete_ui import (Ferrum, NEW_DB_PATH)
  39. if os.path.exists(NEW_DB_PATH):
  40. os.remove(NEW_DB_PATH)
  41. # make sure we use local pwman
  42. sys.path.insert(0, os.getcwd())
  43. # check if old DB exists, if so remove it.
  44. # excuted only once when invoked upon import or
  45. # upon run
  46. SetupTester().clean()
  47. def suite():
  48. loader = unittest.TestLoader()
  49. suite = unittest.TestSuite()
  50. #suite.addTest(loader.loadTestsFromTestCase(DBTests))
  51. #suite.addTest(loader.loadTestsFromTestCase(CryptoTest))
  52. #suite.addTest(loader.loadTestsFromTestCase(CLITests))
  53. #suite.addTest(loader.loadTestsFromTestCase(ConfigTest))
  54. #suite.addTest(loader.loadTestsFromTestCase(FactoryTest))
  55. #suite.addTest(loader.loadTestsFromTestCase(TestDBFalseConfig))
  56. suite.addTest(loader.loadTestsFromTestCase(CryptoEngineTest))
  57. suite.addTest(loader.loadTestsFromTestCase(TestConfig))
  58. suite.addTest(loader.loadTestsFromTestCase(TestSQLite))
  59. suite.addTest(loader.loadTestsFromTestCase(TestImporter))
  60. suite.addTest(loader.loadTestsFromTestCase(TestFactory))
  61. suite.addTest(loader.loadTestsFromTestCase(TestBaseUI))
  62. suite.addTest(loader.loadTestsFromTestCase(TestInit))
  63. #if 'win' not in sys.platform:
  64. # suite.addTest(loader.loadTestsFromTestCase(Ferrum))
  65. return suite
  66. if __name__ == '__main__':
  67. #unittest.main(verbosity=1, failfast=True)
  68. unittest.TextTestRunner(verbosity=2, failfast=True).run(suite())