X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=tests%2Ftest_inp.py;h=75bcd011b55b4f8a69ccbe35cf3bac1dabae5ef9;hb=6b291135cca79646a47544dec8584f96944ed3de;hp=ff3cfa4f0884905acf3a59e1ccea66a0a5c9ae38;hpb=d31c0e3f3f33c7b99cd972d0761f2744de068f1f;p=m_librarian.git diff --git a/tests/test_inp.py b/tests/test_inp.py old mode 100755 new mode 100644 index ff3cfa4..75bcd01 --- a/tests/test_inp.py +++ b/tests/test_inp.py @@ -1,23 +1,15 @@ -#! /usr/bin/env python - -import os -from tests import TestCase, main +from pytest import raises +from dbutils import setup_module, teardown_module # noqa +from dbutils import load_inpx from m_librarian.db import Author, Book -from m_librarian.inp import import_inpx - -class TestInp(TestCase): - def test_import_bad_inpx(self): - self.assertRaises( - ValueError, import_inpx, - os.path.join(os.path.dirname(__file__), 'bad.inpx')) - def test_import_inpx(self): - import_inpx(os.path.join(os.path.dirname(__file__), 'test.inpx')) - self.assertEqual(Author.select().count(), 4) - self.assertEqual(Book.select().count(), 4) +def test_import_bad_inpx(): + raises(ValueError, load_inpx, 'bad.inpx') -if __name__ == "__main__": - main() +def test_import_inpx(): + load_inpx('test.inpx') + assert Author.select().count() == 4 + assert Book.select().count() == 4