diff test/test_indexer.py @ 5036:380d8d8b30a3

Replace existing run_tests.py script with a pytest script The existing run_test.py script is quite old, a bit restrictive, and doesn't always behave as documented. The pytest testing tool is mature, well documented, and maintained. The run_tests.py script is generating by installing py.test and running: py.tests --genscript=run_tests.py Note: to generate a script that is compatible with python2.6 the command needs to be run using python2.6
author John Kristensen <john@jerrykan.com>
date Thu, 20 Aug 2015 18:15:23 +1000
parents 63c79c0992ae
children 364c54991861
line wrap: on
line diff
--- a/test/test_indexer.py	Fri Aug 21 17:37:22 2015 +1000
+++ b/test/test_indexer.py	Thu Aug 20 18:15:23 2015 +1000
@@ -20,15 +20,27 @@
 
 import os, unittest, shutil
 
+import pytest
 from roundup.backends import get_backend, have_backend
 from roundup.backends.indexer_rdbms import Indexer
 
 # borrow from other tests
 from db_test_base import setupSchema, config
-from test_postgresql import postgresqlOpener
-from test_mysql import mysqlOpener
+from .test_postgresql import postgresqlOpener, skip_postgresql
+from .test_mysql import mysqlOpener, skip_mysql
 from test_sqlite import sqliteOpener
 
+try:
+    import xapian
+    SKIP_XAPIAN = False
+except ImportError:
+    SKIP_XAPIAN = True
+
+skip_xapian = pytest.mark.skipif(
+    SKIP_XAPIAN,
+    reason="Skipping Xapian indexer tests: 'xapian' not installed")
+
+
 class db:
     class config(dict):
         DATABASE = 'test-index'
@@ -139,6 +151,8 @@
     def tearDown(self):
         shutil.rmtree('test-index')
 
+
+@skip_xapian
 class XapianIndexerTest(IndexerTest):
     def setUp(self):
         if os.path.exists('test-index'):
@@ -164,6 +178,7 @@
             shutil.rmtree(config.DATABASE)
 
 
+@skip_postgresql
 class postgresqlIndexerTest(postgresqlOpener, RDBMSIndexerTest, IndexerTest):
     def setUp(self):
         postgresqlOpener.setUp(self)
@@ -173,6 +188,7 @@
         postgresqlOpener.tearDown(self)
 
 
+@skip_mysql
 class mysqlIndexerTest(mysqlOpener, RDBMSIndexerTest, IndexerTest):
     def setUp(self):
         mysqlOpener.setUp(self)

Roundup Issue Tracker: http://roundup-tracker.org/