From 0eb031fc93630731f2344deda8123e36c0375235 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 6 Jan 2017 20:48:11 +0100 Subject: Don't leave empty entries when a test fails --- tests/test_collection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_collection.py b/tests/test_collection.py index a2c1a87..beab6e0 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -98,8 +98,11 @@ class testEntries(unittest.TestCase): def setUp(self): self.collection = lesana.Collection('tests/data/simple') self.basepath = 'tests/data/simple/items' + self.filenames = [] def tearDown(self): + for fname in self.filenames: + os.remove(fname) shutil.rmtree(os.path.join(self.collection.basedir, '.lesana')) def test_simple(self): @@ -119,6 +122,7 @@ class testEntries(unittest.TestCase): new_entry = lesana.Entry(self.collection) self.collection.save_entries(entries=[new_entry]) entry_fname = 'tests/data/simple/items/' + new_entry.fname + self.filenames.append(entry_fname) with open(entry_fname) as fp: text = fp.read() self.assertIn('quantity (integer): how many items are there', text) @@ -127,7 +131,6 @@ class testEntries(unittest.TestCase): written = ruamel.yaml.safe_load(text) self.assertIsInstance(written['quantity'], int) self.assertIsInstance(written['name'], str) - os.remove(entry_fname) def test_entry_representation(self): uid = '11189ee47ddf4796b718a483b379f976' -- cgit v1.2.3