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)