1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
# test_00.py
# initial (hence the name '00') definitions for testing purposes
"""\
TESTS:
CurrentEnvironment
Environment
"""
import clips, unittest
import gc
class ctestcase(unittest.TestCase):
"""base class for pyclips unit test cases"""
def setUp(self):
"""set up testing environment"""
e1 = clips.Environment()
self.envdict = {
'clips': clips,
'env': e1,
}
clips.DebugConfig.WatchAll()
e1.DebugConfig.WatchAll()
def tearDown(self):
clips.DebugConfig.UnwatchAll()
self.envdict['env'].DebugConfig.UnwatchAll()
s = clips.TraceStream.Read()
fc = open("trace.out", 'a')
fc.write("=" * 78 + "\n")
fc.write("--> %s\n" % self.__class__.__name__)
fc.write("-" * 78 + "\n")
fc.write("%s" % s)
fc.write("\n\n\n")
fc.close()
s = clips.ErrorStream.Read()
fc = open("error.out", 'a')
fc.write("=" * 78 + "\n")
fc.write("--> %s\n" % self.__class__.__name__)
fc.write("-" * 78 + "\n")
fc.write("%s" % s)
fc.write("\n\n\n")
fc.close()
o = gc.collect()
fc = open("garbage.out", 'a')
fc.write("%s --> %s unreached objects\n" % (
self.__class__.__name__, o))
fc.close()
# end.
|