Browse files

Replace index close hacks with new public method

  • Loading branch information...
1 parent 1f8bebb commit 23521fde747018abf3341e638cca4b1a8659f0af @peterjc peterjc committed Apr 8, 2013
Showing with 7 additions and 7 deletions.
  1. +2 −2 Tests/search_tests_common.py
  2. +3 −3 Tests/test_SeqIO_index.py
  3. +2 −2 Tests/test_Uniprot.py
View
4 Tests/search_tests_common.py
@@ -26,7 +26,7 @@ def check_raw(self, filename, id, raw, **kwargs):
idx = SearchIO.index(filename, self.fmt, **kwargs)
raw = _as_bytes(raw)
self.assertEqual(raw, idx.get_raw(id))
- idx._proxy._handle.close() # To silence a ResourceWarning
+ idx.close()
#Now again, but using SQLite backend
if sqlite3:
@@ -81,7 +81,7 @@ def check_index(self, filename, format, **kwargs):
self.assertNotEqual(id(qres), id(dbidx_qres))
self.assertTrue(compare_search_obj(qres, dbidx_qres))
- indexed._proxy._handle.close() # TODO - Better solution
+ indexed.close()
if sqlite3 is not None:
db_indexed.close()
db_indexed._con.close()
View
6 Tests/test_SeqIO_index.py
@@ -114,7 +114,7 @@ def simple_check(self, filename, format, alphabet, comp):
rec_dict = SeqIO.index(filename, format, alphabet)
self.check_dict_methods(rec_dict, id_list, id_list)
- rec_dict._proxy._handle.close() # TODO - Better solution
+ rec_dict.close()
del rec_dict
if not sqlite3:
@@ -177,7 +177,7 @@ def key_check(self, filename, format, alphabet, comp):
key_list = [add_prefix(id) for id in id_list]
rec_dict = SeqIO.index(filename, format, alphabet, add_prefix)
self.check_dict_methods(rec_dict, key_list, id_list)
- rec_dict._proxy._handle.close() # TODO - Better solution
+ rec_dict.close()
del rec_dict
if not sqlite3:
@@ -340,7 +340,7 @@ def get_raw_check(self, filename, format, alphabet, comp):
else:
rec2 = SeqIO.read(handle, format, alphabet)
self.assertEqual(True, compare_record(rec1, rec2))
- rec_dict._proxy._handle.close() # TODO - Better solution
+ rec_dict.close()
del rec_dict
if sqlite3:
View
4 Tests/test_Uniprot.py
@@ -341,8 +341,8 @@ def test_multi_ex_index(self):
for old in xml_list:
new = xml_index[old.id]
compare_record(old, new)
- txt_index._proxy._handle.close() #hack
- xml_index._proxy._handle.close() #hack
+ txt_index.close()
+ xml_index.close()
if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity = 2)

0 comments on commit 23521fd

Please sign in to comment.