Procházet zdrojové kódy

fix unit testing wit setup

oz123 před 11 roky
rodič
revize
6284de2566
3 změnil soubory, kde provedl 29 přidání a 13 odebrání
  1. 12 0
      pwman/tests/__init__.py
  2. 12 5
      pwman/tests/test_pwman.py
  3. 5 8
      setup.py

+ 12 - 0
pwman/tests/__init__.py

@@ -0,0 +1,12 @@
+import test_pwman
+
+def suite():
+    import unittest
+    #import doctest
+    suite = unittest.TestSuite()
+    #suite.addTests(doctest.DocTestSuite(helloworld))
+    suite.addTests(test_pwman.suite())
+    return suite
+
+if __name__ == '__main__':
+    unittest.TextTestRunner(verbosity=2).run(suite())

+ 12 - 5
pwman/tests/test_pwman.py

@@ -64,8 +64,9 @@ try:
                                  'cls_timeout': '5'
                                  },
                       'Database': {'type': 'SQLite',
-                                   'filename': os.path.join("tests",
-                                                            "test.pwman.db")},
+                                   'filename':
+                                   os.path.join(os.path.dirname(__file__),
+                                   "test.pwman.db")},
                       'Encryption': {'algorithm': 'AES'},
                       'Readline': {'history': os.path.join("tests",
                                                            "history")}
@@ -121,8 +122,14 @@ except SystemExit, e:
 
 
 import unittest
-from db_tests import CLITests
 from db_tests import DBTests
-from crypto_tests import CryptoTest
+
+
+def suite():
+    loader = unittest.TestLoader()
+    suite = unittest.TestSuite()
+    suite.addTest(loader.loadTestsFromTestCase(DBTests))
+    return suite
+
 if __name__ == '__main__':
-    unittest.main()
+    unittest.TextTestRunner(verbosity=2).run(suite())

+ 5 - 8
setup.py

@@ -3,11 +3,9 @@
 script to install pwman3
 """
 
-#from distutils.core import setup
-from setuptools import Command, setup
+from setuptools import setup
 import pwman
 
-
 setup(name=pwman.appname,
       version=pwman.version,
       description=pwman.description,
@@ -24,10 +22,9 @@ setup(name=pwman.appname,
       scripts=['scripts/pwman3'],
       zip_safe=False,
       install_requires=['pycrypto>=2.6',
-                'colorama>=0.2.4'],
+                        'colorama>=0.2.4'],
       classifiers=[
           'Environment :: Console',
-
           'Intended Audience :: End Users/Desktop',
           'Intended Audience :: Developers',
           'Intended Audience :: System Administrators',
@@ -37,6 +34,6 @@ setup(name=pwman.appname,
           'Operating System :: POSIX',
           'Programming Language :: Python',
           'Programming Language :: Python :: 2.7'
-          ],
-      test_suite="tests"
-)
+      ],
+      test_suite='pwman.tests'
+      )