Package bazaar.test
This module simplifies unit testing of applications and libraries,
which use Bazaar ORM library.
Let's suppose, that lib
library is going to be tested and
there are created two modules lib.test.a
and
lib.test.b
with unit tests for the library.
To run unit tests, which use Bazaar ORM library, application classes
should be specified. To specify application classes set
bazaar.test.TestCase.cls_list
attribute, i.e.:
bazaar.test.TestCase.cls_list = (lib.Class1, lib.Class2)
To run all unit tests lib.test.all
module can be created,
lib/test/all.py
:
import bazaar.test
bazaar.test.TestCase.cls_list = (lib.Class1, lib.Class2) # set application classes
if __name__ = '__main__'
# import all library test cases into lib.test.all module namespace,
# so the all tests will be run
from bazaar.test.a import *
from bazaar.test.b import *
# run all tests
bazaar.test.main()
Module lib.test.a
source code example:
import bazaar.test
import lib.test.all # this import sets application classes
class ATestCase(bazaar.test.DBTestCase):
pass
if __name__ == '__main__':
bazaar.test.main()
Module lib.test.b
source code example:
import bazaar.test
import lib.test.all # this import sets application classes
class BTestCase(bazaar.test.DBTestCase):
pass
if __name__ == '__main__':
bazaar.test.main()
To run all tests:
python lib/test/all.py bazaar.ini
To run tests contained in lib.test.a
module:
python lib/test/a.py bazaar.ini
Classes |
DBTestCase |
Base class for Bazaar ORM layer tests with database connection. |
TestCase |
Base class for Bazaar ORM layer tests. |
Function Summary |
|
main ()
Set Bazaar ORM library configuration file and run all unit tests. |
main()
Set Bazaar ORM library configuration file and run all unit
tests.
-
|