From d0a53427134fa05d5d1751b557e74f52cca451f4 Mon Sep 17 00:00:00 2001 From: Bongjin Koo Date: Tue, 17 May 2022 15:14:41 -0700 Subject: [PATCH] Issue #74: Remove os.system() in test_datasets.py. --- tests/test_datasets.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_datasets.py b/tests/test_datasets.py index 255ef82..b8b528f 100644 --- a/tests/test_datasets.py +++ b/tests/test_datasets.py @@ -8,6 +8,7 @@ import os import random import string +import subprocess import pytest @@ -22,7 +23,7 @@ def setup(): username="ninamio78@gmail.com", token="HBGGBOJcLYQfadEKIOyXJiLTum3ydXK4nGP3KmbkYUeBuYkZma9LPBSYennQn92gjP2NHn", project_id="xbr2m", - osflient_path="$CONDA/bin/", + osfclient_path="$CONDA/bin/", ) yield project @@ -91,7 +92,7 @@ def test_upload_valid(setup, set_file_path): line = file_list.readline() assert file_exists - os.system(f"rm {set_file_path[0]}{set_file_path[1]}") + subprocess.run(f"rm {set_file_path[0]}{set_file_path[1]}", shell=True) def test_upload_invalid_because_no_local_path(setup): @@ -110,7 +111,7 @@ def test_download_valid(setup, set_file_path): """Test the download method.""" setup.download(set_file_path[1], set_file_path[0] + set_file_path[1]) assert os.path.exists(set_file_path[0] + set_file_path[1]) - os.system(f"rm {set_file_path[0]}{set_file_path[1]}") + subprocess.run(f"rm {set_file_path[0]}{set_file_path[1]}", shell=True) def test_download_invalid_because_no_remote_path(setup):