Просмотр исходного кода

Override setup.py test to fail fast

Oz N Tiram 8 лет назад
Родитель
Сommit
a26cf09586
3 измененных файлов с 21 добавлено и 2 удалено
  1. 1 0
      pwman/data/factory.py
  2. 19 2
      setup.py
  3. 1 0
      tests/test_base_ui.py

+ 1 - 0
pwman/data/factory.py

@@ -74,6 +74,7 @@ def check_db_version(dburi):
 def createdb(dburi, version):
 
     dburi = urlparse(dburi)
+    print("dburi : {}".format(dburi))
     dbtype = dburi.scheme
     try:
         cls = getattr(drivers, create_db_map[dbtype][0])

+ 19 - 2
setup.py

@@ -54,6 +54,23 @@ add to your ```setup.cfg``` the following::
 
 # build.sub_commands.append(('build_manpage', None))
 
+class TestCommand(Command):
+    user_options = []
+
+    def initialize_options(self):
+        pass
+
+    def finalize_options(self):
+        pass
+
+    def run(self):
+        import sys, subprocess
+
+        raise SystemExit(
+            subprocess.call([sys.executable,
+                             '-m',
+                             'tests.test_pwman']))
+
 
 class BuildManPage(Command):
 
@@ -337,9 +354,9 @@ setup(name='pwman3',
                    'Programming Language :: Python :: 3.4',
                    'Programming Language :: Python :: 3.5',
                    ],
-      test_suite='tests.test_pwman.suite',
       cmdclass={
-          'build_manpage': BuildManPage
+          'build_manpage': BuildManPage,
+          'test': TestCommand
       },
       entry_points={
           'console_scripts': ['pwman3 = pwman.ui.cli:main']

+ 1 - 0
tests/test_base_ui.py

@@ -31,6 +31,7 @@ from pwman.data.nodes import Node
 testdb = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                       "test-baseui.pwman.db"))
 
+print(testdb)
 
 class dummy_stdin(object):