Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Fix: don't fetch already installed package
Browse files Browse the repository at this point in the history
  • Loading branch information
ento committed Nov 16, 2016
1 parent ca4f2b1 commit 282682a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion native_package_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def update_elm_package(vendor_dir, configs, packages):


def exclude_downloaded_packages(vendor_dir, packages):
return [x for x in packages if not os.path.isdir(format_tar_path(vendor_dir, x))]
return [x for x in packages if not os.path.isfile(format_tar_path(vendor_dir, x))]


def main(native_elm_package, configs, vendor_dir):
Expand Down
13 changes: 10 additions & 3 deletions tests/test_native_package_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@



def test_main(tmpdir, mocker):
def test_main_does_not_download_twice(tmpdir, mocker):
native_elm_package = {'elm-lang/core': '1.0.0'}
native_elm_package_path = tmpdir.join('elm-native-package.json')
native_elm_package_path.write(json.dumps(native_elm_package))
Expand Down Expand Up @@ -43,5 +43,12 @@ def test_main(tmpdir, mocker):
list(map(str, (elm_package_one_path, elm_package_two_path))),
str(vendor))

# mvp is to test that main runs without raising an exception;
# not asserting anything for now
with open(str(fake_native_tarball_path)) as f:
urlopen.return_value = f

native_package_install.main(
str(native_elm_package_path),
list(map(str, (elm_package_one_path, elm_package_two_path))),
str(vendor))

assert urlopen.call_count == 1

0 comments on commit 282682a

Please sign in to comment.