[test] ensure cubicweb.devtools is imported first
authorDavid Douard <david.douard@logilab.fr>
Wed, 30 Apr 2014 15:44:54 +0200
changeset 1501 a45f5a997ab2
parent 1500 8feacc325d69
child 1503 70da3e54219b
[test] ensure cubicweb.devtools is imported first so the cubes are in sys.path
test/realdb_test_apycot.py
test/test_functional.py
test/unittest_apycot.py
test/unittest_checkers.py
test/unittest_checkers_jslint.py
test/unittest_checkers_pyunit.py
test/unittest_entities.py
test/unittest_hooks.py
test/unittest_parser.py
test/unittest_preprocessors.py
test/unittest_repositories.py
test/unittest_task.py
test/unittest_utils.py
test/unittest_writer.py
--- a/test/realdb_test_apycot.py	Fri Apr 25 16:46:49 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-from cubicweb.devtools import buildconfig, loadconfig
-from cubicweb.devtools.testlib import RealDBTest
-
-def setUpModule(options):
-    if options.source:
-        configcls = loadconfig(options.source)
-    elif options.dbname is None:
-        raise Exception('either <sourcefile> or <dbname> options are required')
-    else:
-        configcls = buildconfig(options.dbuser, options.dbpassword,
-                                               options.dbname, options.euser,
-                                               options.epassword)
-    RealDatabaseTC.configcls = configcls
-
-class RealDatabaseTC(RealDBTest):
-    configcls = None # set by setUpModule()
-
-    def test_all_primaries(self):
-        for rset in self.iter_individual_rsets(limit=50):
-            yield self.view, 'primary', rset, rset.req.reset_headers()
-    
-    ## startup views
-    def test_startup_views(self):
-        for vid in self.list_startup_views():
-            req = self.request()
-            yield self.view, vid, None, req
-
-
-if __name__ == '__main__':
-    from logilab.common.testlib import unittest_main
-    unittest_main()
--- a/test/test_functional.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/test_functional.py	Wed Apr 30 15:44:54 2014 +0200
@@ -2,6 +2,7 @@
 import subprocess
 import shutil
 
+import cubicweb.devtools
 import cubes.apycot.testutils as utils
 
 from cubes.apycot.recipes import full_script
--- a/test/unittest_apycot.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_apycot.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,8 +1,9 @@
-from __future__ import with_statement
+#!/usr/bin/python
+import cubicweb.devtools
 
 from cubes.apycot.testutils import ApycotBaseTC
 
-from apycotlib import FAILURE, SUCCESS 
+from apycotlib import FAILURE, SUCCESS
 from apycotlib.writer import TestDataWriter
 from narvalbot import HTTPConnectionHandler
 
--- a/test/unittest_checkers.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_checkers.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 """
 unit tests for checkers
 """
@@ -11,6 +12,7 @@
 
 from logilab.common.testlib import unittest_main, TestCase, TestSuite
 
+import cubicweb.devtools
 from cubes.apycot.testutils import MockTest, MockRepository, MockCheckWriter, input_path
 
 
--- a/test/unittest_checkers_jslint.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_checkers_jslint.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,5 +1,6 @@
+#!/usr/bin/python
+
 from logilab.common.testlib import TestSuite, TestCase, unittest_main
-
 from unittest_checkers import FileCheckerTest, WRITER
 
 try:
--- a/test/unittest_checkers_pyunit.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_checkers_pyunit.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 """
 unit tests for python test checkers
 """
@@ -7,6 +8,7 @@
 
 from logilab.common.testlib import unittest_main, TestCase, mock_object
 
+import cubicweb.devtools
 from cubes.apycot.testutils import MockCheckWriter, input_path
 
 from apycotlib import SUCCESS, FAILURE, ERROR, PARTIAL, NODATA
--- a/test/unittest_entities.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_entities.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 from logilab.common.testlib import unittest_main
 
 from cubicweb import ValidationError
--- a/test/unittest_hooks.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_hooks.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 import os
 import re
 
--- a/test/unittest_parser.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_parser.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,7 +1,9 @@
+#!/usr/bin/python
 import logging
 
 from logilab.common.testlib import TestCase, unittest_main
 
+import cubicweb.devtools
 import cubes.apycot # import this first
 
 from apycotlib import SimpleOutputParser
--- a/test/unittest_preprocessors.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_preprocessors.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,8 +1,9 @@
 # -*- coding: utf-8 -*-
+import json
+
+import cubicweb.devtools
 
 from cubes.apycot.testutils import ApycotBaseTC
-
-import json
 from apycotlib import atest, writer, REGISTRY
 import preprocessors.apycot.distutils
 from cubicweb.utils import json_dumps
--- a/test/unittest_repositories.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_repositories.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,10 +1,12 @@
+#!/usr/bin/python
 """unit tests for apycot.repositories"""
 
-from logilab.common import testlib
-
 import os
 from copy import copy
 
+from logilab.common import testlib
+
+import cubicweb.devtools
 from cubes.apycot.testutils import MockVCSFile as VCSFile
 
 from apycotlib.repositories import *
--- a/test/unittest_task.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_task.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
 import shutil
 import tarfile
 import sys
@@ -7,6 +9,7 @@
 from logilab.common.testlib import TestCase, unittest_main, mock_object, within_tempdir
 
 # import this first will set import machinery on
+import cubicweb.devtools
 from cubes.apycot.testutils import MockTestWriter, MockRepository, MockConnection, MockVCSFile, input_path
 
 from apycotlib import SetupException
--- a/test/unittest_utils.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_utils.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
 from logilab.common.testlib import TestCase, unittest_main
 from cubicweb import devtools # setup import machinery
 from cubes.apycot.entities import text_to_dict
--- a/test/unittest_writer.py	Fri Apr 25 16:46:49 2014 +0200
+++ b/test/unittest_writer.py	Wed Apr 30 15:44:54 2014 +0200
@@ -1,7 +1,10 @@
+#!/usr/bin/python
 """unit tests for the apycotlib.writer module"""
+
 import os
 from logilab.common.testlib import TestCase, unittest_main
 
+import cubicweb.devtools
 import cubes.apycot.testutils
 
 from apycotlib.writer import BaseDataWriter