From b4666465820e4589756f14c0d73291dc69a01e1e Mon Sep 17 00:00:00 2001 From: "x93ma@edu.uwaterloo.ca" Date: Sun, 2 May 2021 21:08:43 -0400 Subject: [PATCH] remove temp_dir --- tests/test_load_qrels.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_load_qrels.py b/tests/test_load_qrels.py index 1fad4fcce..aa45722c7 100644 --- a/tests/test_load_qrels.py +++ b/tests/test_load_qrels.py @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +import os +import shutil import unittest from pyserini import search @@ -26,6 +27,9 @@ def read_file_lines(path): class TestGetQrels(unittest.TestCase): + def setUp(self): + os.environ['PYSERINI_CACHE'] = 'temp_dir' + def test_robust04(self): qrels_path = search.get_qrels_file('robust04') lines = read_file_lines(qrels_path) @@ -247,6 +251,10 @@ def test_trec2019_bl(self): self.assertEqual(mid_line, "853 0 2444d88d62539b0b88dc919909cb9701 2") self.assertEqual(last_line, "885 0 fde80cb0-b4f0-11e2-bbf2-a6f9e9d79e19 0") + def tearDown(self): + if os.path.exists('temp_dir'): + shutil.rmtree('temp_dir') + if __name__ == '__main__': unittest.main()