Skip to content

Commit

Permalink
Issue #46
Browse files Browse the repository at this point in the history
Some more capitals have been removed from the code and tests. There
still remains some in the tests, however these cannot be removed until
the next Longbow release is out and the example files on hecbiosim.ac.uk
are updated.
  • Loading branch information
jimboid committed Jun 5, 2017
1 parent 17f350b commit 270aac9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions longbow/corelibs/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def _downloadexamples(longbowargs):

# Check if the examples have already been downloaded first.
if not os.path.isfile(
os.path.join(os.getcwd(), "LongbowExamples.zip")):
os.path.join(os.getcwd(), "longbow-examples.zip")):

print("Downloading examples...")

Expand All @@ -505,24 +505,25 @@ def _downloadexamples(longbowargs):
subprocess.check_call([
"wget", "http://www.hecbiosim.ac.uk/downloads/send/"
"2-software/4-longbow-examples", "-O",
os.path.join(os.getcwd(), "LongbowExamples.zip")])
os.path.join(os.getcwd(), "longbow-examples.zip")])

except subprocess.CalledProcessError:

subprocess.call([
"curl", "-L", "http://www.hecbiosim.ac.uk/downloads/send/"
"2-software/4-longbow-examples", "-o",
os.path.join(os.getcwd(), "LongbowExamples.zip")])
os.path.join(os.getcwd(), "longbow-examples.zip")])

# Unzip the archive file.
print("Extracting the archive file...")

subprocess.call(["unzip", "-d", os.getcwd(),
os.path.join(os.getcwd(), "LongbowExamples.zip")])
subprocess.call(
["unzip", "-d", os.getcwd(),
os.path.join(os.getcwd(), "longbow-examples.zip")])

print("Removing the zip archive file...")

os.remove(os.path.join(os.getcwd(), "LongbowExamples.zip"))
os.remove(os.path.join(os.getcwd(), "longbow-examples.zip"))

print("Done.")

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/corelibs_entrypoints/test_downloadexamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def test_downloadexamples_wget():

_downloadexamples(longbowargs)

assert not os.path.isfile(os.path.join(os.getcwd(), "LongbowExamples.zip"))
assert not os.path.isfile(
os.path.join(os.getcwd(), "longbow-examples.zip"))
assert os.path.isdir(os.path.join(os.getcwd(), "LongbowExamples/"))

if os.path.isdir(os.path.join(os.getcwd(), "LongbowExamples/")):
Expand All @@ -75,7 +76,8 @@ def test_downloadexamples_curl(mock_check_call):

_downloadexamples(longbowargs)

assert not os.path.isfile(os.path.join(os.getcwd(), "LongbowExamples.zip"))
assert not os.path.isfile(
os.path.join(os.getcwd(), "longbow-examples.zip"))
assert os.path.isdir(os.path.join(os.getcwd(), "LongbowExamples/"))

if os.path.isdir(os.path.join(os.getcwd(), "LongbowExamples/")):
Expand Down

0 comments on commit 270aac9

Please sign in to comment.