Skip to content

Commit

Permalink
properly fix, more py3 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
gijzelaerr committed Oct 2, 2018
1 parent 134d08d commit 66eeb63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/test_client_util.py
Expand Up @@ -64,8 +64,8 @@ def testSupportedFormatChecking(self):
for file_format, location in self.local.items():
if file_format != 'unsupported':
# Tests the behavior after receiving supported file types with and without the 'file://' prefix
self.assertEquals(wf_info(location), self.expected[file_format])
self.assertEquals(wf_info(location[7:]), self.expected[file_format])
self.assertEqual(wf_info(location), self.expected[file_format])
self.assertEqual(wf_info(location[7:]), self.expected[file_format])

else:
# Tests behavior after receiving a non supported file type.
Expand All @@ -91,7 +91,7 @@ def testFileLocationChecking(self):
wf_info(location)

else:
self.assertEquals(wf_info(location), self.expected[file_format])
self.assertEqual(wf_info(location), self.expected[file_format])
self.assertFalse(os.path.isfile(os.path.join(os.getcwd(), 'fetchedFromRemote.' + file_format)))


Expand Down
7 changes: 3 additions & 4 deletions wes_client/util.py
Expand Up @@ -5,15 +5,14 @@
import yaml
import glob
import requests
import urllib
import logging

from wes_service.util import visit

from future.standard_library import hooks

with hooks():
from urllib.request import pathname2url
from urllib.request import urlopen, pathname2url


def two_seven_compatible(filePath):
Expand Down Expand Up @@ -60,7 +59,7 @@ def wf_info(workflow_path):
html = urlopen(workflow_path).read()
local_loc = os.path.join(os.getcwd(), 'fetchedFromRemote.' + file_type)
with open(local_loc, 'w') as f:
f.write(html)
f.write(html.decode())
version = wf_info('file://' + local_loc)[0] # Don't take the file_type here, found it above.
os.remove(local_loc) # TODO: Find a way to avoid recreating file before version determination.
else:
Expand Down Expand Up @@ -90,7 +89,7 @@ def fixpaths(d):
if "path" in d:
if ":" not in d["path"]:
local_path = os.path.normpath(os.path.join(os.getcwd(), basedir, d["path"]))
d["location"] = urllib.pathname2url(local_path)
d["location"] = pathname2url(local_path)
else:
d["location"] = d["path"]
del d["path"]
Expand Down

0 comments on commit 66eeb63

Please sign in to comment.