Skip to content

Commit 923de46

Browse files
committed
Try central path.
1 parent 1e429fe commit 923de46

1 file changed

Lines changed: 22 additions & 15 deletions

File tree

tests/tests_integration/test_gdrive_connection.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,60 @@
1+
import builtins
12
import os
23
from pathlib import Path
34

45
import pytest
56
import test_utils
67
from base import BaseTest
78

9+
from datashuttle import DataShuttle
810
from datashuttle.configs.canonical_configs import get_broad_datatypes
911

1012

11-
@pytest.mark.skipif(os.getenv("CI") is None, reason="Only runs in CI")
13+
# @pytest.mark.skipif(os.getenv("CI") is None, reason="Only runs in CI")
1214
class TestGoogleDriveGithubCI(BaseTest):
1315

14-
def test_google_drive_connection(self, project):
15-
# ── 1 pull the secrets from env ───────────────────────────────
16+
@pytest.fixture(scope="function")
17+
def transfer_project_info(self, tmp_path):
18+
""" """
19+
project = DataShuttle("transfer_project")
20+
central_path = Path(*tmp_path.parts[-2:]).as_posix()
21+
22+
return (project, central_path)
23+
24+
def test_google_drive_connection(self, transfer_project_info):
25+
26+
project, central_path = transfer_project_info
27+
1628
root_id = os.environ["GDRIVE_ROOT_FOLDER_ID"]
1729
sa_path = os.environ["GDRIVE_SERVICE_ACCOUNT_FILE"]
1830

19-
# ── 2 configure the project (no hard-coded ids/paths) ─────────
2031
project.update_config_file(
2132
local_path=str(
2233
Path.home() / "data"
2334
), # any temp location TODO UPDATE
2435
connection_method="gdrive",
25-
central_path="testGDrive",
36+
central_path=central_path,
2637
gdrive_root_folder_id=root_id,
2738
gdrive_client_id=None, # keep None
2839
)
2940

30-
# ── 3 feed the SA-file path to the interactive prompt ─────────
3141
state = {"first": True}
3242

3343
def mock_input(_: str) -> str:
3444
if state["first"]:
3545
state["first"] = False
36-
return "n" # ← tells setup to use file, not auth-browser
37-
return sa_path # ← absolute path written in the workflow
38-
39-
import builtins
46+
return "n"
47+
return sa_path
4048

4149
original_input = builtins.input
4250
builtins.input = mock_input
4351

44-
try:
45-
project.setup_google_drive_connection()
46-
finally:
47-
builtins.input = original_input # always restore
52+
project.setup_google_drive_connection()
53+
54+
builtins.input = original_input
4855

49-
# ── 4 run the usual checks ────────────────────────────────────
5056
subs, sessions = test_utils.get_default_sub_sessions_to_test()
57+
5158
test_utils.make_and_check_local_project_folders(
5259
project, "rawdata", subs, sessions, get_broad_datatypes()
5360
)

0 commit comments

Comments
 (0)