From 04bcc1922b58d1e6e2d330c49f70351e3dc7a901 Mon Sep 17 00:00:00 2001 From: Andrey Fedorov Date: Tue, 6 Feb 2024 16:18:57 -0500 Subject: [PATCH] BUG: fix path to the manifests used by tests re #38 --- tests/idcindex.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/idcindex.py b/tests/idcindex.py index 5e0ee22..6ca88eb 100644 --- a/tests/idcindex.py +++ b/tests/idcindex.py @@ -5,6 +5,7 @@ import tempfile import unittest +import pytest from idc_index import index # Run tests using the following command from the root of the repository: @@ -13,6 +14,11 @@ logging.basicConfig(level=logging.INFO) +@pytest.fixture(autouse=True) +def _change_test_dir(request, monkeypatch): + monkeypatch.chdir(request.fspath.dirname) + + class TestIDCClient(unittest.TestCase): def setUp(self): self.client = index.IDCClient() @@ -92,7 +98,7 @@ def test_sql_queries(self): def test_download_from_aws_manifest(self): with tempfile.TemporaryDirectory() as temp_dir: self.client.download_from_manifest( - manifestFile="./tests/study_manifest_aws.s5cmd", downloadDir=temp_dir + manifestFile="./study_manifest_aws.s5cmd", downloadDir=temp_dir ) self.assertEqual(len(os.listdir(temp_dir)), 15) @@ -100,7 +106,7 @@ def test_download_from_aws_manifest(self): def test_download_from_gcp_manifest(self): with tempfile.TemporaryDirectory() as temp_dir: self.client.download_from_manifest( - manifestFile="./tests/study_manifest_gcs.s5cmd", downloadDir=temp_dir + manifestFile="./study_manifest_gcs.s5cmd", downloadDir=temp_dir ) self.assertEqual(len(os.listdir(temp_dir)), 15)