-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix version regex when querying veresions
- Loading branch information
Showing
9 changed files
with
131 additions
and
59 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
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
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,41 @@ | ||
# SPDX-FileCopyrightText: 2024 Alec Delaney, for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
"""Tests the backend functionality. | ||
Author(s): Alec Delaney | ||
""" | ||
|
||
import shutil | ||
|
||
import pytest | ||
|
||
import circfirm.backend.cache | ||
|
||
|
||
def test_parse_firmware_info() -> None: | ||
"""Tests the ability to get firmware information.""" | ||
board_id = "feather_m4_express" | ||
language = "en_US" | ||
|
||
# Test successful parsing | ||
for version in ("8.0.0", "9.0.0-beta.2"): | ||
try: | ||
board_folder = circfirm.backend.cache.get_board_folder(board_id) | ||
circfirm.backend.cache.download_uf2(board_id, version, language) | ||
downloaded_filename = [file.name for file in board_folder.glob("*")][0] | ||
|
||
( | ||
parsed_version, | ||
parsed_language, | ||
) = circfirm.backend.parse_firmware_info(downloaded_filename) | ||
assert parsed_version == version | ||
assert parsed_language == language | ||
finally: | ||
# Clean up post tests | ||
shutil.rmtree(board_folder) | ||
|
||
# Test failed parsing | ||
with pytest.raises(ValueError): | ||
circfirm.backend.parse_firmware_info("cannotparse") |
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
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
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