Added skeletons for Python unit tests
This commit is contained in:
parent
8021955292
commit
f29fc1eb12
6 changed files with 98 additions and 4 deletions
|
|
@ -1,6 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
PYTHONPATH="%builddir%/.libs":$PYTHONPATH \
|
PYTHONPATH="%builddir%/.libs":$PYTHONPATH \
|
||||||
LD_LIBRARY_PATH="%builddir%/.libs":$LD_LIBRARY_PATH \
|
LD_LIBRARY_PATH="%builddir%/.libs":$LD_LIBRARY_PATH \
|
||||||
DYLD_LIBRARY_PATH="%builddir%/.libs":$DYLD_LIBRARY_PATH \
|
DYLD_LIBRARY_PATH="%builddir%/.libs":$DYLD_LIBRARY_PATH \
|
||||||
%python% "%builddir%"/test/python/UnitTests.py
|
%python% "%builddir%"/test/python/ConvertedTests.py
|
||||||
|
|
||||||
|
PYTHONPATH="%builddir%/.libs":$PYTHONPATH \
|
||||||
|
LD_LIBRARY_PATH="%builddir%/.libs":$LD_LIBRARY_PATH \
|
||||||
|
DYLD_LIBRARY_PATH="%builddir%/.libs":$DYLD_LIBRARY_PATH \
|
||||||
|
%python% "%srcdir%"/test/python/UnitTests.py
|
||||||
|
|
|
||||||
25
test/python/JournalTest.py
Normal file
25
test/python/JournalTest.py
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import exceptions
|
||||||
|
import operator
|
||||||
|
|
||||||
|
from ledger import *
|
||||||
|
from StringIO import *
|
||||||
|
from datetime import *
|
||||||
|
|
||||||
|
class JournalTestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
25
test/python/PostingTest.py
Normal file
25
test/python/PostingTest.py
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import exceptions
|
||||||
|
import operator
|
||||||
|
|
||||||
|
from ledger import *
|
||||||
|
from StringIO import *
|
||||||
|
from datetime import *
|
||||||
|
|
||||||
|
class PostingTestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
return unittest.TestLoader().loadTestsFromTestCase(PostingTestCase)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
25
test/python/TransactionTest.py
Normal file
25
test/python/TransactionTest.py
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import exceptions
|
||||||
|
import operator
|
||||||
|
|
||||||
|
from ledger import *
|
||||||
|
from StringIO import *
|
||||||
|
from datetime import *
|
||||||
|
|
||||||
|
class JournalTestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
12
test/python/UnitTests.py
Normal file
12
test/python/UnitTests.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
from unittest import TextTestRunner, TestSuite
|
||||||
|
|
||||||
|
import JournalTest
|
||||||
|
import TransactionTest
|
||||||
|
import PostingTest
|
||||||
|
|
||||||
|
suites = [
|
||||||
|
JournalTest.suite(),
|
||||||
|
TransactionTest.suite(),
|
||||||
|
PostingTest.suite()
|
||||||
|
]
|
||||||
|
TextTestRunner().run(TestSuite(suites))
|
||||||
|
|
@ -321,7 +321,7 @@ all_py_tests_sources = \
|
||||||
test/python/%.py: test/unit/%.cc test/convert.py
|
test/python/%.py: test/unit/%.cc test/convert.py
|
||||||
$(PYTHON) $(srcdir)/test/convert.py $< $@
|
$(PYTHON) $(srcdir)/test/convert.py $< $@
|
||||||
|
|
||||||
test/python/UnitTests.py: $(all_py_tests_sources)
|
test/python/ConvertedTests.py: $(all_py_tests_sources)
|
||||||
@echo "from unittest import TextTestRunner, TestSuite" > $@
|
@echo "from unittest import TextTestRunner, TestSuite" > $@
|
||||||
@for file in $$(ls $(srcdir)/test/unit/*.cc); do \
|
@for file in $$(ls $(srcdir)/test/unit/*.cc); do \
|
||||||
base=$$(basename $$file); \
|
base=$$(basename $$file); \
|
||||||
|
|
@ -346,7 +346,7 @@ ESC_distdir=`echo "$(distdir)" | sed 's/\//\\\\\//g'`
|
||||||
|
|
||||||
# jww (2007-05-10): This rule will not be triggered on systems that
|
# jww (2007-05-10): This rule will not be triggered on systems that
|
||||||
# define an EXEEXT.
|
# define an EXEEXT.
|
||||||
PyUnitTests: test/PyUnitTests.py test/python/UnitTests.py
|
PyUnitTests: test/PyUnitTests.py test/python/ConvertedTests.py
|
||||||
@cat $(srcdir)/test/PyUnitTests.py \
|
@cat $(srcdir)/test/PyUnitTests.py \
|
||||||
| sed "s/%python%/$(ESC_python)/" \
|
| sed "s/%python%/$(ESC_python)/" \
|
||||||
| sed "s/%srcdir%/$(ESC_srcdir)/g" \
|
| sed "s/%srcdir%/$(ESC_srcdir)/g" \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue