test_pwman.py 2.5 KB

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