This repository has been archived by the owner on May 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add native_package_install test and rename functions/variables to mat…
…ch the nomenclature used in elm compiler
- Loading branch information
Showing
4 changed files
with
97 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
hypothesis | ||
pytest | ||
pytest-mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
enum34==1.1.6 | ||
# | ||
# This file is autogenerated by pip-compile | ||
# To update, run: | ||
# | ||
# pip-compile --output-file dev-requirements.txt dev-requirements.in | ||
# | ||
enum34==1.1.6 # via hypothesis | ||
funcsigs==1.0.2 # via mock | ||
hypothesis==3.6.0 | ||
py==1.4.31 | ||
pytest==3.0.3 | ||
mock==2.0.0 # via pytest-mock | ||
pbr==1.10.0 # via mock | ||
py==1.4.31 # via pytest | ||
pytest-mock==1.4.0 | ||
pytest==3.0.4 | ||
six==1.10.0 # via mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import json | ||
import tarfile | ||
import urllib2 | ||
|
||
import native_package_install | ||
|
||
|
||
|
||
def test_main(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)) | ||
|
||
fake_native_tarball_path = tmpdir.join('core.tgz') | ||
with tmpdir.as_cwd(): | ||
with tarfile.open(str(fake_native_tarball_path), 'w') as f: | ||
fake_elm_package = tmpdir.mkdir('core-1.0.0').join('elm-package.json') | ||
fake_elm_package.write(json.dumps({ | ||
'source-directories': ['src', 'src2'], | ||
})) | ||
f.add(str(fake_elm_package.relto(tmpdir))) | ||
|
||
elm_package_one_path = tmpdir.join('elm-package-one.json') | ||
elm_package_one_path.write(json.dumps({ | ||
'repository': 'https://github.com/NoRedInk/elm-ops-tooling.git', | ||
'source-directories': ['.'], | ||
})) | ||
|
||
elm_package_two_path = tmpdir.join('elm-package-two.json') | ||
elm_package_two_path.write(json.dumps({ | ||
'repository': 'https://github.com/NoRedInk/elm-ops-tooling-two.git', | ||
'source-directories': ['src'], | ||
})) | ||
|
||
vendor = tmpdir.mkdir('vendor') | ||
|
||
urlopen = mocker.patch.object(urllib2, 'urlopen') | ||
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)) | ||
|
||
# mvp is to test that main runs without raising an exception; | ||
# not asserting anything for now |