about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBonfaceKilz2021-03-23 01:12:04 +0300
committerBonfaceKilz2021-03-23 01:14:37 +0300
commit5151987063eab58b10a2dd8e831ec036df217531 (patch)
tree96bd672a23efc59de72c46124abc286f20921ba4
parenta35933013cede542d03d678b6e4a92f4e8f2cf40 (diff)
downloadgenenetwork3-5151987063eab58b10a2dd8e831ec036df217531.tar.gz
Convert Path object to a str
* gn3/file_utils.py (cache_ipfs_file): Return a str instead of a path object.
* tests/unit/test_file_utils.py: Update failing tests.
-rw-r--r--gn3/file_utils.py7
-rw-r--r--tests/unit/test_file_utils.py2
2 files changed, 5 insertions, 4 deletions
diff --git a/gn3/file_utils.py b/gn3/file_utils.py
index 5296613..73f6567 100644
--- a/gn3/file_utils.py
+++ b/gn3/file_utils.py
@@ -91,7 +91,8 @@ def cache_ipfs_file(ipfs_file: str,
     if not os.path.exists(file_loc):
         client = ipfshttpclient.connect(ipfs_addr)
         client.get(ipfs_file,
-                   target=pathlib.Path
-                   (os.path.join(cache_dir,
-                                 ipfs_file.split("ipfs/")[-1])).parent)
+                   target=str(
+                       pathlib.Path
+                       (os.path.join(cache_dir,
+                                     ipfs_file.split("ipfs/")[-1])).parent))
     return file_loc
diff --git a/tests/unit/test_file_utils.py b/tests/unit/test_file_utils.py
index abe7aa6..219db0e 100644
--- a/tests/unit/test_file_utils.py
+++ b/tests/unit/test_file_utils.py
@@ -116,5 +116,5 @@ extracting the file"""
              "QmQPeNsJPyVWPFDVHb"
              "77w8G42Fvo15z4bG2X8D2GhfbSXc-test/"
              "genotype.txt"),
-            target=f"{test_dir}/genotype.txt"
+            target=f"{test_dir}"
         )