use 9.x in all test mock devices. Fix package subimport logic. Fix tests. Update from_auto_files_local test to mimic Fruit Jam OS usage.
This commit is contained in:
parent
ab32fc2b5b
commit
18a4687739
8 changed files with 44 additions and 5 deletions
|
|
@ -721,7 +721,9 @@ def get_all_imports( # pylint: disable=too-many-arguments,too-many-locals, too-
|
||||||
"/"
|
"/"
|
||||||
)[:-1]
|
)[:-1]
|
||||||
)
|
)
|
||||||
|
|
||||||
full_location = os.path.join(file_location, file_name)
|
full_location = os.path.join(file_location, file_name)
|
||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# file is in root of CIRCUITPY
|
# file is in root of CIRCUITPY
|
||||||
full_location = file_name
|
full_location = file_name
|
||||||
|
|
@ -729,7 +731,7 @@ def get_all_imports( # pylint: disable=too-many-arguments,too-many-locals, too-
|
||||||
exists = backend.file_exists(full_location)
|
exists = backend.file_exists(full_location)
|
||||||
if not exists:
|
if not exists:
|
||||||
file_name = os.path.join(*install_module.split("."), "__init__.py")
|
file_name = os.path.join(*install_module.split("."), "__init__.py")
|
||||||
full_location = os.path.join(file_location, file_name)
|
full_location = file_name
|
||||||
exists = backend.file_exists(full_location)
|
exists = backend.file_exists(full_location)
|
||||||
if not exists:
|
if not exists:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
11
tests/mock_device/apps/test_app/import_styles.py
Normal file
11
tests/mock_device/apps/test_app/import_styles.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
# pylint: disable=all
|
||||||
|
import os, sys
|
||||||
|
import adafruit_bus_device
|
||||||
|
from adafruit_button import Button
|
||||||
|
from adafruit_esp32spi import adafruit_esp32spi_socketpool
|
||||||
|
from adafruit_display_text import wrap_text_to_pixels, wrap_text_to_lines
|
||||||
|
import adafruit_hid.consumer_control
|
||||||
|
import import_styles_sub
|
||||||
5
tests/mock_device/apps/test_app/import_styles_sub.py
Normal file
5
tests/mock_device/apps/test_app/import_styles_sub.py
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# SPDX-FileCopyrightText: 2025 Neradoc
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
# pylint: disable=all
|
||||||
|
import adafruit_ntp
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
Adafruit CircuitPython 10.0.0-alpha.6 on 2019-08-02; Adafruit CircuitPlayground Express with samd21g18
|
Adafruit CircuitPython 9.0.0 on 2019-08-02; Adafruit CircuitPlayground Express with samd21g18
|
||||||
Board ID:this_is_a_board
|
Board ID:this_is_a_board
|
||||||
UID:AAAABBBBCCCC
|
UID:AAAABBBBCCCC
|
||||||
|
|
|
||||||
11
tests/mock_device/import_styles.py
Normal file
11
tests/mock_device/import_styles.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
# pylint: disable=all
|
||||||
|
import os, sys
|
||||||
|
import adafruit_bus_device
|
||||||
|
from adafruit_button import Button
|
||||||
|
from adafruit_esp32spi import adafruit_esp32spi_socketpool
|
||||||
|
from adafruit_display_text import wrap_text_to_pixels, wrap_text_to_lines
|
||||||
|
import adafruit_hid.consumer_control
|
||||||
|
import import_styles_sub
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
Adafruit CircuitPython 8.1.0 on 2019-08-02; Adafruit CircuitPlayground Express with samd21g18
|
Adafruit CircuitPython 9.0.0 on 2019-08-02; Adafruit CircuitPlayground Express with samd21g18
|
||||||
Board ID:this_is_a_board
|
Board ID:this_is_a_board
|
||||||
UID:AAAABBBBCCCC
|
UID:AAAABBBBCCCC
|
||||||
|
|
|
||||||
5
tests/mock_device_2/import_styles_sub.py
Normal file
5
tests/mock_device_2/import_styles_sub.py
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# SPDX-FileCopyrightText: 2025 Neradoc
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
# pylint: disable=all
|
||||||
|
import adafruit_ntp
|
||||||
|
|
@ -1186,7 +1186,11 @@ def test_get_all_imports():
|
||||||
test_data = fp.read()
|
test_data = fp.read()
|
||||||
|
|
||||||
result = get_all_imports(
|
result = get_all_imports(
|
||||||
backend, test_data, test_file, mod_names, current_module=""
|
backend,
|
||||||
|
test_data,
|
||||||
|
os.path.join(backend.device_location, "import_styles.py"),
|
||||||
|
mod_names,
|
||||||
|
current_module="",
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result == [
|
assert result == [
|
||||||
|
|
@ -1215,7 +1219,7 @@ def test_libraries_from_auto_file_local():
|
||||||
"adafruit_ntp",
|
"adafruit_ntp",
|
||||||
]
|
]
|
||||||
|
|
||||||
auto_file = "./tests/import_styles.py"
|
auto_file = "apps/test_app/import_styles.py"
|
||||||
|
|
||||||
with mock.patch("circup.logger.info") as mock_logger, mock.patch(
|
with mock.patch("circup.logger.info") as mock_logger, mock.patch(
|
||||||
"circup.os.path.isfile", return_value=True
|
"circup.os.path.isfile", return_value=True
|
||||||
|
|
@ -1267,6 +1271,7 @@ def test_libraries_from_auto_file_board():
|
||||||
result = libraries_from_auto_file(backend, auto_file, mod_names)
|
result = libraries_from_auto_file(backend, auto_file, mod_names)
|
||||||
|
|
||||||
assert result == [
|
assert result == [
|
||||||
|
"adafruit_ntp",
|
||||||
"adafruit_spd1608",
|
"adafruit_spd1608",
|
||||||
"adafruit_spd1656",
|
"adafruit_spd1656",
|
||||||
"adafruit_ssd1675",
|
"adafruit_ssd1675",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue