diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-01-06 20:48:11 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-01-06 20:48:11 +0100 |
commit | 0eb031fc93630731f2344deda8123e36c0375235 (patch) | |
tree | a4c14f775c736fd08da255e5563934e9180f5990 /tests | |
parent | b4b6e6723a3b4fe107e607ce0ec5b81f72e72a5a (diff) |
Don't leave empty entries when a test fails
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_collection.py | 5 |
1 files changed, 4 insertions, 1 deletions
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' |