diff options
-rw-r--r-- | src/py_session.cc | 5 | ||||
-rw-r--r-- | test/python/JournalTest.py | 4 | ||||
-rw-r--r-- | test/python/PostingTest.py | 4 | ||||
-rw-r--r-- | test/python/TransactionTest.py | 4 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/py_session.cc b/src/py_session.cc index b948997c..167eb2a4 100644 --- a/src/py_session.cc +++ b/src/py_session.cc @@ -55,6 +55,9 @@ namespace { { return str_to_py_unicode(error_context()); } + void py_close_journal_files() { + python_session->close_journal_files(); + } } void export_session() @@ -74,6 +77,8 @@ void export_session() scope().attr("session") = object(ptr(static_cast<session_t *>(python_session.get()))); + scope().attr("close_journal_files") = + python::make_function(&py_close_journal_files); scope().attr("read_journal") = python::make_function(&py_read_journal, return_internal_reference<>()); diff --git a/test/python/JournalTest.py b/test/python/JournalTest.py index 2565ede8..84ad2f43 100644 --- a/test/python/JournalTest.py +++ b/test/python/JournalTest.py @@ -6,7 +6,7 @@ from ledger import * class JournalTestCase(unittest.TestCase): def tearDown(self): - session.close_journal_files() + close_journal_files() def testBasicRead(self): journal = read_journal_from_string(""" @@ -37,7 +37,7 @@ class JournalTestCase(unittest.TestCase): try: fun() except RuntimeError as e: - self.assertEquals(str(e).splitlines()[-1], + self.assertEqual(str(e).splitlines()[-1], "No quantity specified for amount") diff --git a/test/python/PostingTest.py b/test/python/PostingTest.py index f191253e..0dd18112 100644 --- a/test/python/PostingTest.py +++ b/test/python/PostingTest.py @@ -1,11 +1,9 @@ # -*- coding: utf-8 -*- import unittest -import exceptions import operator from ledger import * -from StringIO import * from datetime import * class PostingTestCase(unittest.TestCase): @@ -13,7 +11,7 @@ class PostingTestCase(unittest.TestCase): pass def tearDown(self): - pass + close_journal_files() def test_(self): pass diff --git a/test/python/TransactionTest.py b/test/python/TransactionTest.py index 66447f87..257eb377 100644 --- a/test/python/TransactionTest.py +++ b/test/python/TransactionTest.py @@ -1,11 +1,9 @@ # -*- coding: utf-8 -*- import unittest -import exceptions import operator from ledger import * -from StringIO import * from datetime import * class JournalTestCase(unittest.TestCase): @@ -13,7 +11,7 @@ class JournalTestCase(unittest.TestCase): pass def tearDown(self): - pass + close_journal_files() def test_(self): pass |