Cheetah.Tests.CheetahWrapper module

Tests for the ‘cheetah’ command.

Besides unittest usage, recognizes the following command-line options:
–list CheetahWrapper.py
List all scenarios that are tested. The argument is the path of this script.
--nodelete Don’t delete scratch directory at end.
--output Show the output of each subcommand. (Normally suppressed.)
class Cheetah.Tests.CheetahWrapper.CFBase(methodName='runTest')

Bases: unittest.case.TestCase

Base class for “cheetah compile” and “cheetah fill” unit tests.

assertPosixSubprocess(cmd)
assertSubprocess(cmd, nonzero=False)
assertWin32Subprocess(cmd)
checkCompile(path)
checkFill(path)
checkNoBackup(path)

Verify ‘path’ does not exist. (To check –nobackup.)

checkSubdirPyInit(path)

Verify a destination subdirectory exists and contains an __init__.py file.

expectError = False
go(cmd, expectedStatus=0, expectedOutputSubstring=None)

Run a “cheetah compile” or “cheetah fill” subcommand.

in : cmd, string, the command to run.
expectedStatus, int, subcommand’s expected output status.
0 if the subcommand is expected to succeed, 1-255 otherwise.
expectedOutputSubstring, string, substring which much appear
in the standard output or standard error. None to skip this test.

out: None.

inform(message)
locate_cheetah(cmd)
setUp()

Create the top-level directories, subdirectories and .tmpl files.

srcDir = ''
srcFiles = ('a.tmpl', 'child/a.tmpl', 'child/grandkid/a.tmpl')
subdirs = ('child', 'child/grandkid')
tearDown()

Hook method for deconstructing the test fixture after testing it.

class Cheetah.Tests.CheetahWrapper.CFIdirBase(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

Subclass for tests with –idir.

srcDir = 'SRC'
srcFiles = ('SRC/a.tmpl', 'SRC/child/a.tmpl', 'SRC/child/grandkid/a.tmpl')
subdirs = ('SRC/child', 'SRC/child/grandkid')
class Cheetah.Tests.CheetahWrapper.FileDataFill(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

Populate searchlist variables from pickled or JSON data

checkCompile(path)
checkFill(path)
setUp()

Create the top-level directories and .tmpl files.

srcFiles = ('pickle.tmpl', 'json.tmpl')
tearDown()

Hook method for deconstructing the test fixture after testing it.

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.Flat(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.FlatRecurseCollision(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

expectError = True
testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.IdirFlatRecurseCollision(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFIdirBase

expectError = True
testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.IdirOdirRecurse(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFIdirBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.IdirRecurse(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFIdirBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.NoBackup(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

Run the command twice each time and verify a backup file is not created.

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.OneFile(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.OneFileNoExtension(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.OneFileWithOdir(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.Popen4(cmd, bufsize=-1, shell=True, close_fds=True, stdin=-1, stdout=-1, stderr=-2, **kwargs)

Bases: subprocess.Popen

class Cheetah.Tests.CheetahWrapper.RecurseExplicit(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.RecurseExplicitWIthOdir(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.RecurseImplicit(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.SplatTmpl(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.SplatTmplWithSubdirectories(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.ThreeFilesWithSubdirectories(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.ThreeFilesWithSubdirectoriesNoExtension(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
class Cheetah.Tests.CheetahWrapper.VarietyWithOdir(methodName='runTest')

Bases: Cheetah.Tests.CheetahWrapper.CFBase

testCompile()
testFill()
testText()
Cheetah.Tests.CheetahWrapper.listTests(cheetahWrapperFile)

cheetahWrapperFile, string, path of this script.

XXX TODO: don’t print test where expectError is true.

Cheetah.Tests.CheetahWrapper.main()
Cheetah.Tests.CheetahWrapper.warn(msg)