-
-
Notifications
You must be signed in to change notification settings - Fork 405
Optimize core
operations, improving on the user input
#1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a07b4d8
[breaking] remove `parseArch` var since it is always true
umbynos bfcf4cb
[breaking] make packages and platform case insensitive
umbynos 185da71
enhance comments and do not optimize if results are != 1
umbynos e238250
add logging
umbynos ea0bf34
add simple test, install, uninstall etc are already covered since the…
umbynos 0b7a3bb
Apply suggestions from code review
umbynos 4fba6b6
add new error to handle multiple platform found, return res if the st…
umbynos b8e91a3
enhance comment describing what the function does
umbynos db987b9
add test to verify that an operation on two fake cores is not possible
umbynos 3849a27
skip test failing on macOS and on win and optimize the test
umbynos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -240,6 +240,10 @@ def test_core_download(run_command, downloads_dir): | |
result = run_command(["core", "download", "bananas:avr"]) | ||
assert result.failed | ||
|
||
# Wrong casing | ||
result = run_command(["core", "download", "Arduino:[email protected]"]) | ||
assert os.path.exists(os.path.join(downloads_dir, "packages", "core-ArduinoCore-samd-1.8.12.tar.bz2")) | ||
|
||
|
||
def _in(jsondata, name, version=None): | ||
installed_cores = json.loads(jsondata) | ||
|
@@ -685,6 +689,46 @@ def test_core_list_platform_without_platform_txt(run_command, data_dir): | |
assert core["name"] == "some-packager-some-arch" | ||
|
||
|
||
@pytest.mark.skipif( | ||
platform.system() in ["Darwin", "Windows"], | ||
reason="macOS by default is case insensitive https://github.com/actions/virtual-environments/issues/865 " | ||
+ "Windows too is case insensitive" | ||
+ "https://stackoverflow.com/questions/7199039/file-paths-in-windows-environment-not-case-sensitive", | ||
) | ||
def test_core_download_multiple_platforms(run_command, data_dir): | ||
assert run_command(["update"]) | ||
|
||
# Verifies no core is installed | ||
res = run_command(["core", "list", "--format", "json"]) | ||
assert res.ok | ||
cores = json.loads(res.stdout) | ||
assert len(cores) == 0 | ||
|
||
# Simulates creation of two new cores in the sketchbook hardware folder | ||
test_boards_txt = Path(__file__).parent / "testdata" / "boards.local.txt" | ||
boards_txt = Path(data_dir, "packages", "PACKAGER", "hardware", "ARCH", "1.0.0", "boards.txt") | ||
boards_txt.parent.mkdir(parents=True, exist_ok=True) | ||
boards_txt.touch() | ||
assert boards_txt.write_bytes(test_boards_txt.read_bytes()) | ||
|
||
boards_txt1 = Path(data_dir, "packages", "packager", "hardware", "arch", "1.0.0", "boards.txt") | ||
boards_txt1.parent.mkdir(parents=True, exist_ok=True) | ||
boards_txt1.touch() | ||
assert boards_txt1.write_bytes(test_boards_txt.read_bytes()) | ||
|
||
# Verifies the two cores are detected | ||
res = run_command(["core", "list", "--format", "json"]) | ||
assert res.ok | ||
cores = json.loads(res.stdout) | ||
assert len(cores) == 2 | ||
|
||
# Try to do an operation on the fake cores. | ||
# The cli should not allow it since optimizing the casing results in finding two cores | ||
res = run_command(["core", "upgrade", "Packager:Arch"]) | ||
assert res.failed | ||
assert "Invalid argument passed: Found 2 platform for reference" in res.stderr | ||
|
||
|
||
def test_core_with_wrong_custom_board_options_is_loaded(run_command, data_dir): | ||
test_platform_name = "platform_with_wrong_custom_board_options" | ||
platform_install_dir = Path(data_dir, "hardware", "arduino-beta-dev", test_platform_name) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.