Changeset 4651 for exist


Ignore:
Timestamp:
15/12/08 16:49:46 (11 years ago)
Author:
cbyrom
Message:

Adjust test suite to become:
a) test environment (i.e. running as noseTest or individual unittest) agnostic;
and b) os agnostic - i.e. coping with different path separators.
Add additional documenation.

Location:
exist/trunk/python
Files:
1 added
3 deleted
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/aaareadme

    r3150 r4651  
     1Contents: 
     2 
    13ElementTree included here to simplify inclusion in other NDG code 
     4 
     5ndgUtils - ndgutils code 
     6ndgutilstests - tests for the various ndgUtils modules. 
  • exist/trunk/python/ndgutilstests/lib/testexistdbclient.py

    r4630 r4651  
    8080        self.dbc.deleteEXistFile(createdAtom.getDefaultCollectionPath() + createdAtom.atomName) 
    8181 
    82  
    8382    def testGetAtom(self): 
    8483        createdAtom = tc.createAtomInEXist(tc.xmlString) 
  • exist/trunk/python/ndgutilstests/lib/testgranulite.py

    r4648 r4651  
    2323        set up data used in the tests. 
    2424        ''' 
    25         self.g = granulite(tc.TEST_GRANULITE) 
     25        self.g = granulite(tc.TEST_GRANULITE, eXistClient = tc.client) 
    2626 
    2727    def testProcessGranulite(self): 
     
    128128        self.assertEqual(len(atom.relatedLinks) + 1, len(updatedAtom.relatedLinks)) 
    129129        self.dbc.deleteEXistFile(atomPath) 
     130        import pdb 
     131        pdb.set_trace() 
    130132 
    131133 
  • exist/trunk/python/ndgutilstests/models/testdif.py

    r4488 r4651  
    33from ndgUtils.ndgObject import ndgObject 
    44from ndgUtils.models.myconfig import myConfig 
     5import ndgutilstests.testconstants as tc 
    56 
    67class TestCase(unittest.TestCase): 
     
    1415    inputFile2= 'examples/bodc.eg3.difChange.dif' 
    1516    inputFile2= 'examples/ndg.noc.soton.ac.uk__DIF__NOCSDAT162.xml' 
    16     configFile= '../testdata/ndgDiscovery.config' 
    17     inputFile3= '../testdata/dataent_NDSC_DIF.xml' 
    1817 
    1918     
     
    2120        ''' Load example config and DIF files for testing ''' 
    2221        from ndgUtils.xmlHandler2 import xmlHandler 
    23         x=xmlHandler(self.inputFile3) 
     22        x=xmlHandler(tc.DIF_FILE) 
    2423        self.dif=DIF(x.tree,et=1) 
    25         self.config=myConfig(self.configFile) 
     24        self.config=myConfig(tc.NDG_CONFIG_FILE) 
    2625 
    2726    def testEntries(self): 
  • exist/trunk/python/ndgutilstests/models/teststubb.py

    r4488 r4651  
    33from ndgUtils import ndgRetrieve, xmlHandler2 
    44from ndgUtils.models.myconfig import myConfig 
    5          
     5import ndgutilstests.testconstants as tc 
    66     
    77class TestCase(unittest.TestCase): 
     
    1414             
    1515        def getit(self,doc): 
    16             self.c=myConfig('../testdata/ndgDiscovery.config') 
     16            self.c=myConfig(tc.NDG_CONFIG_FILE) 
    1717            uri=ndgObject(doc) 
    1818            status,xml=ndgRetrieve(uri,self.c, discovery=0) 
  • exist/trunk/python/ndgutilstests/test_eXistInterface.py

    r4488 r4651  
    11import unittest,os 
    22from ndgUtils.eXistInterface import * 
     3import ndgutilstests.testconstants as tc 
    34 
    45class TestCase(unittest.TestCase): 
     
    67        ''' Try to connect to the exist databases available ''' 
    78        try: 
    8             passwordFile='passwords.txt' 
     9            passwordFile= tc.DBCONFIG_FILE 
    910            f=open(passwordFile,'r') 
    1011            pw={} 
     
    1617        except IOError,e: 
    1718            raise IOError('''\n 
    18         Running this test requires a "passwords.txt" file in directory %s  
     19        Running this test requires a "exist.config" file in directory %s  
    1920        This file should include one or more lines of the form: 
    2021                hostname username password  
  • exist/trunk/python/ndgutilstests/testconstants.py

    r4641 r4651  
    1616import ndgUtils.lib.existdbclient as dbc 
    1717from ndgUtils.models.Atom import Atom 
     18import os 
    1819 
    19 DBCONFIG_FILE = "exist.config" 
     20BASE_DIR = 'ndgutilstests' 
    2021 
    21 TEST_GRANULITE = '../testdata/example.granulite' 
     22curDir = os.getcwd() 
     23prefix = '' 
     24if not curDir.endswith(BASE_DIR): 
     25    prefix = '..' + os.sep 
     26     
     27TEST_DATA_DIR = prefix + 'testdata' + os.sep 
     28DBCONFIG_FILE = TEST_DATA_DIR + 'exist.config' 
     29TEST_GRANULITE = TEST_DATA_DIR + 'example.granulite' 
     30 
     31NDG_CONFIG_FILE = TEST_DATA_DIR + 'ndgDiscovery.config' 
     32DIF_FILE = TEST_DATA_DIR + 'dataent_NDSC_DIF.xml' 
     33 
    2234GRANULITE_TITLE = 'this is a new test granulite' 
    2335GRANULITE_TIME_AXIS = 'time0' 
    24 GRANULITE_CDML_DATASETID = 'hadgem1_dataset' 
     36GRANULITE_CDML_DATASETID = 'test_hadgem1_dataset' 
    2537GRANULITE_PROVIDER_ID = 'badc.nerc.ac.uk' 
    2638GRANULITE_DATASETID = 'calum_data_set' 
     
    145157              '/db/moles_support/granuleAtom/famous_control_month_granule.moles'] 
    146158 
    147 #t1 = '2792-12-16 0:0:0.0' 
    148 #t2 = '2992-11-16 0:0:0.0' 
    149  
    150159client = dbc.eXistDBClient(configFile = DBCONFIG_FILE, setUpDB = True) 
    151160 
Note: See TracChangeset for help on using the changeset viewer.