Przeglądaj źródła

Windows fixes

Maintaing a unix like software for windows is a curse ...
oz123 10 lat temu
rodzic
commit
f5e32607f5
3 zmienionych plików z 19 dodań i 9 usunięć
  1. 1 0
      pwman/tests/db_tests.py
  2. 11 8
      pwman/tests/test_pwman.py
  3. 7 1
      setup.py

+ 1 - 0
pwman/tests/db_tests.py

@@ -383,6 +383,7 @@ class FactoryTest(unittest.TestCase):
         db = factory.create('SQLite', filename='foo.db')
         db._open()
         self.assertTrue(os.path.exists('foo.db'))
+        db.close()
         os.unlink('foo.db')
         self.assertIsInstance(db, SQLiteDatabaseNewForm)
         self.assertRaises(DatabaseException, factory.create, 'UNKNOWN')

+ 11 - 8
pwman/tests/test_pwman.py

@@ -25,10 +25,12 @@ from .db_tests import (DBTests, SetupTester, CLITests, ConfigTest,
                        TestDBFalseConfig, FactoryTest)
 
 from .crypto_tests import CryptoTest
-from .test_complete_ui import Ferrum, NEW_DB_PATH
 
-if os.path.exists(NEW_DB_PATH):
-    os.remove(NEW_DB_PATH)
+if 'win' not in sys.platform:
+    from .test_complete_ui import Ferrum, NEW_DB_PATH
+
+    if os.path.exists(NEW_DB_PATH):
+        os.remove(NEW_DB_PATH)
 
 # make sure we use local pwman
 sys.path.insert(0, os.getcwd())
@@ -43,11 +45,12 @@ def suite():
     suite = unittest.TestSuite()
     suite.addTest(loader.loadTestsFromTestCase(DBTests))
     suite.addTest(loader.loadTestsFromTestCase(CryptoTest))
-    #suite.addTest(loader.loadTestsFromTestCase(CLITests))
-    #suite.addTest(loader.loadTestsFromTestCase(ConfigTest))
-    #suite.addTest(loader.loadTestsFromTestCase(FactoryTest))
-    #suite.addTest(loader.loadTestsFromTestCase(TestDBFalseConfig))
-    #suite.addTest(loader.loadTestsFromTestCase(Ferrum))
+    suite.addTest(loader.loadTestsFromTestCase(CLITests))
+    suite.addTest(loader.loadTestsFromTestCase(ConfigTest))
+    suite.addTest(loader.loadTestsFromTestCase(FactoryTest))
+    suite.addTest(loader.loadTestsFromTestCase(TestDBFalseConfig))
+    if 'win' not in sys.platform:
+        suite.addTest(loader.loadTestsFromTestCase(Ferrum))
     return suite
 
 if __name__ == '__main__':

+ 7 - 1
setup.py

@@ -43,6 +43,12 @@ class PyCryptoInstallCommand(install):
             print(('Please use pip or your Distro\'s package manager '
                    'to install pycrypto ...'))
 
+if 'win' in sys.platform:
+    test_requirements =  None
+else:
+    test_requirements = ['pexpect']
+
+
 
 setup(name=pwman.appname,
       version=describe(),
@@ -75,7 +81,7 @@ setup(name=pwman.appname,
           'Programming Language :: Python :: 2.7'
       ],
       test_suite='pwman.tests.suite',
-      tests_require=['pexpect'],
+      tests_require=test_requirements, 
       cmdclass={
           'install_pycrypto': PyCryptoInstallCommand,
           'build_manpage': BuildManPage