Package csb :: Package test :: Class Config |
[frames] | no frames]

# Class Config

source code

    object --+
             |
            Config

General CSB Test Config. Config instances contain the following properties:

- data - path to the CSB Test Data directory. Default is Config.DATA
- temp - path to the system's temp directory. Default is Config.TEMP
- config - the Config class

Instance Methods
ensureDataConsistency(self) Try to deserialize some pickled data files. | source code
str |
getContent(self, fileName, subDir=`'````'`) Same as `self.getTestFile`, but also read and return the contents of the file. | source code
object |
getPickle(self, fileName, subDir=`'````'`) Same as `self.getTestFile`, but try to unpickle the the file and return the unpickled object. | source code
file stream |
getTempStream(self, mode=`'``t``'`) Return a temporary file stream: | source code
str |
getTestFile(self, fileName, subDir=`'````'`) Search for `fileName` in the Config.DATA directory. | source code
updateDataFiles(self) Refresh the pickled structures in csb/test/data. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods
setDefaultDataRoot(path) Override the default Config.DATA with a new data root directory. | source code
setDefaultGeneratedDataRoot(path) Override the default Config.GENERATED_DATA with a new data root directory. | source code

Class Variables
| DATA = ``'``/home/travis/build/csb-toolbox/CSB/csb/test/data``'``
| GENERATED_DATA = ``'``/home/travis/build/csb-toolbox/CSB/csb/test/``...``
| TEMP = ``'``/tmp``'``

Properties
str | data Test data directory
str | generatedData Test data directory for generated files
str | temp Test temp directory
Inherited from `object`: `__class__`

Method Details

### ensureDataConsistency(self) | source code
Try to deserialize some pickled data files. Call Config.updateDataFiles if the pickles appeared incompatible with the current interpreter.

### getContent(self, fileName, subDir=`'````'`) | source code
Same as `self.getTestFile`, but also read and return the contents of the file. Parameters: `fileName` (str) - the name of a test file to retrieve `subDir` (str) - scan a sub-directory of Config.DATA Returns: str

### getPickle(self, fileName, subDir=`'````'`) | source code
Same as `self.getTestFile`, but try to unpickle the the file and return the unpickled object. Pickles are usually stored in Config.GENERATED_DATA. Parameters: `fileName` (str) - the name of a test file to retrieve `subDir` (str) - scan a sub-directory of Config.DATA Returns: object

### getTempStream(self, mode=`'``t``'`) | source code
Return a temporary file stream:
       with self.getTempStream() as tmp:
           tmp.write(something)
           tmp.flush()
           file_name = tmp.name
Parameters: `mode` (str) - file open mode (text, binary), default=t Returns: file stream

### getTestFile(self, fileName, subDir=`'````'`) | source code
Search for `fileName` in the Config.DATA directory. If not found, try also Config.GENERATED_DATA (if different). Parameters: `fileName` (str) - the name of a test file to retrieve `subDir` (str) - scan a sub-directory of Config.DATA Returns: str full path to `fileName` Raises: `IOError` - if no such file is found

### setDefaultDataRoot(path) Static Method | source code
Override the default Config.DATA with a new data root directory. Parameters: `path` (str) - full directory path

### setDefaultGeneratedDataRoot(path) Static Method | source code
Override the default Config.GENERATED_DATA with a new data root directory. Parameters: `path` (str) - full directory path

### updateDataFiles(self) | source code
Refresh the pickled structures in csb/test/data. This might be needed when the internal representation of some classes has changed.

Class Variable Details

  ### GENERATED_DATA Value:
      '/home/travis/build/csb-toolbox/CSB/csb/test/data'

Property Details

### data Test data directory Get Method: unreachable.data(self) - Test data directory Type: str

### generatedData Test data directory for generated files Get Method: unreachable.generatedData(self) - Test data directory for generated files Type: str

### temp Test temp directory Get Method: unreachable.temp(self) - Test temp directory Type: str