Skip to content

Commit

Permalink
Issue #74: Testing test_datasets.py, fix test file path.
Browse files Browse the repository at this point in the history
  • Loading branch information
bongjinkoo committed May 17, 2022
1 parent 5852042 commit 3aab671
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 9 additions & 5 deletions ioSPI/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def ls(self):
print(f"Listing files from OSF project: {self.project_id}...")
# os.system("osf ls")
subprocess.run(
f"osf ls", shell=True, text=True, check=True, stdout=subprocess.PIPE
"$CONDA/bin/" + f"osf ls",
shell=True,
text=True,
check=True,
stdout=subprocess.PIPE,
)

def download(self, remote_path: str, local_path: str):
Expand All @@ -85,7 +89,7 @@ def download(self, remote_path: str, local_path: str):
print(f"Downloading {full_remote_path} to {local_path}...")
# os.system(f"osf fetch {full_remote_path} {local_path}")
subprocess.run(
f"osf fetch {full_remote_path} {local_path}",
"$CONDA/bin/" + f"osf fetch {full_remote_path} {local_path}",
shell=True,
text=True,
check=True,
Expand Down Expand Up @@ -121,8 +125,8 @@ def upload(self, local_path: str, remote_path: str):
print(f"Uploading {local_path} to {full_remote_path}...")
# os.system(f"osf upload {local_path} {full_remote_path}")
f = subprocess.run(
"$CONDA/bin/" + f"osf upload /home/runner/work/ioSPI/ioSPI/{local_path} "
f"{full_remote_path}", # Test.
"$CONDA/bin/" + f"osf upload {local_path} "
f"{full_remote_path}", # Test./home/runner/work/ioSPI/ioSPI/
shell=True,
text=True,
check=True,
Expand Down Expand Up @@ -150,7 +154,7 @@ def remove(self, remote_path: str):
print(f"Removing {full_remote_path} in the project...")
# os.system(f"osf remove {full_remote_path}")
subprocess.run(
f"osf remove {full_remote_path}",
"$CONDA/bin/" + f"osf remove {full_remote_path}",
shell=True,
text=True,
check=True,
Expand Down
6 changes: 5 additions & 1 deletion tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ def test_remove_valid(setup, set_file_path):
file_exists = False
# file_list = os.popen("osf ls")
file_list = subprocess.run(
"osf ls", shell=True, text=True, check=True, stdout=subprocess.PIPE
"$CONDA/bin/" + "osf ls",
shell=True,
text=True,
check=True,
stdout=subprocess.PIPE,
).stdout
file_list = io.StringIO(file_list)
line = file_list.readline()
Expand Down

0 comments on commit 3aab671

Please sign in to comment.