From fbbc396568708445cd8108d60c2c3e2185a0a234 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 5 Jun 2023 18:25:25 -0700 Subject: [PATCH] more import tests --- .efrocachemap | 32 ++-- config/featuresets/README.md | 4 +- .../ba_data/python/bauiv1/onscreenkeyboard.py | 160 ++++++++++-------- tests/{test_babase => test_base}/__init__.py | 0 .../test_assetmanager.py | 0 .../test_imports.py | 7 +- tests/test_plus/__init__.py | 1 + tests/test_plus/test_imports.py | 21 +++ tests/test_ui_v1/__init__.py | 1 + tests/test_ui_v1/test_imports.py | 21 +++ tools/batools/featureset.py | 2 +- tools/batools/testrun.py | 6 + 12 files changed, 158 insertions(+), 97 deletions(-) rename tests/{test_babase => test_base}/__init__.py (100%) rename tests/{test_babase => test_base}/test_assetmanager.py (100%) rename tests/{test_babase => test_base}/test_imports.py (72%) create mode 100644 tests/test_plus/__init__.py create mode 100644 tests/test_plus/test_imports.py create mode 100644 tests/test_ui_v1/__init__.py create mode 100644 tests/test_ui_v1/test_imports.py diff --git a/.efrocachemap b/.efrocachemap index bd605e06..4dc98cbd 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4080,18 +4080,18 @@ "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b2/55/64d847b58c501c80b4ea53678e9a", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9f/37/b4553f9f9fda9fb07d7f3f3ab2f6", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cf/b4/d955fed8589fd59e0f15e69ab568", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/12/83/23a307429d4a729f562b954400f6", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0a/e3/4fbc3dc52af3f1b972ef1be52f77", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/2f/33ad58bdcbcb2ac5de570b7b86d4", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a5/56/1b4153622fd9c8d2a1e7f14cf3b7", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/52/98/c2c12cc656073db630da4ef8c996", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d4/50/fc305556a2926c5c69004b49a09a", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a6/95/4745877e61819b8d9747960ca8d4", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d3/bd/39608485bc10553589523928740e", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/bc/5d/513cbfa9287f138912cb73f61783", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/79/2d/0606820548fc2d0f84ceff572049", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ae/b6/653d88e5f1cc84247ad51da0620b", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e3/71/cd19381bd0a9c81f112dd90868ae", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/a4/a8/577d056e8566cd1c084db7f8aaab", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/c3/33/1967e1c77d409733e636b5883a85", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e4/ed/88f5da9640034d053fd68e34b356", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/37/c6/42b4eb716aed07f9a9ed5e1b5bc1", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/2f/37/31627eb0d24b1d85295c8cbdc52d", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/bc/e7/8cda7a606b0c572d59c36df0ac52", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ec/fd/1de6183cbab383ffd981f319562e", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/4d/75/f02f361fff8f8ac49c49823e4638", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/32/43c61f1e11520f764158cf0e76d2", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ca/65/cba463f21a8f76c5bbfe27cae124", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/73/20/119211f1700bb5a410cedf4e76f2", @@ -4108,14 +4108,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/90/9b/94f733c3a48691e02240e04dc792", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/c7/873af48627997b6fab4b2c4ba6bc", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3a/94/4780fada10f0fc3f43a54f29c86f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/b7/3d/d6ab07ea8b3b58c6605ae7864eec", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ad/86/03386a6e15c55e0661e932044c60", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/d3/87/d8024acf61db6b471bc5aa19e57f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/f5/1b/783a8c5673613b66fc73b16724ee", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/54/92/f516fb3937a7c0c52bffdcb223f2", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/2b/8c/59209d69c14c866957e83d6a5495", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/1f/a5/5b2f8514ce9eccadea84c0d1c7e9", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/d8/d2/727ea6711db0cbc9e03b7a995b46", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/6f/26/c227f23af91c96c8b1081f74ff1c", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/8c/c8/4b4312d3c6b3293a37dca0661233", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/61/db/055d73f415ebbcd377f0a7f5cd16", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c5/70/4d6a2171de7316f7d8796f526fc9", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/c7/9f/60f9af18ef8fc02018e96cc2ba0d", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/59/0c/58ea59ed03c625212ff28ff51092", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/b9/40/be2c8f8da250538230feda77589f", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/6a/49/ac9574ec9359804b019fb71044f9", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/4e/07/87dd93e7ef29b8b78d0b4791d6f8", diff --git a/config/featuresets/README.md b/config/featuresets/README.md index d9f1d579..2fec0f7e 100644 --- a/config/featuresets/README.md +++ b/config/featuresets/README.md @@ -30,6 +30,6 @@ with specific naming conventions: named `bafoobarmeta` ('ba' prefix, name with spaces removed, 'meta' suffix) that lives under [meta source files](../../src/meta). - **Test Package**: If feature set `foo_bar` provides a set of tests, it should - be a directory named `test_bafoobar` ('test_ba' prefix, name with spaces - removed) under [tests](../../tests). + be a directory named `test_foo_bar` ('test_' prefix, unmodified feature set + name) under [tests](../../tests). diff --git a/src/assets/ba_data/python/bauiv1/onscreenkeyboard.py b/src/assets/ba_data/python/bauiv1/onscreenkeyboard.py index d1371fb8..db7f647f 100644 --- a/src/assets/ba_data/python/bauiv1/onscreenkeyboard.py +++ b/src/assets/ba_data/python/bauiv1/onscreenkeyboard.py @@ -7,22 +7,30 @@ from __future__ import annotations import logging from typing import cast -import bauiv1 as bui +from typing import TYPE_CHECKING + +import babase +from _babase import screenmessage +import _bauiv1 +from bauiv1.ui import Window + +if TYPE_CHECKING: + import bauiv1 as bui -class OnScreenKeyboardWindow(bui.Window): +class OnScreenKeyboardWindow(Window): """Simple built-in on-screen keyboard.""" def __init__(self, textwidget: bui.Widget, label: str, max_chars: int): self._target_text = textwidget self._width = 700 self._height = 400 - assert bui.app.classic is not None - uiscale = bui.app.classic.ui.uiscale - top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 + assert babase.app.classic is not None + uiscale = babase.app.classic.ui.uiscale + top_extra = 20 if uiscale is babase.UIScale.SMALL else 0 super().__init__( - root_widget=bui.containerwidget( - parent=bui.get_special_widget('overlay_stack'), + root_widget=_bauiv1.containerwidget( + parent=_bauiv1.get_special_widget('overlay_stack'), size=(self._width, self._height + top_extra), transition='in_scale', scale_origin_stack_offset=( @@ -30,49 +38,49 @@ class OnScreenKeyboardWindow(bui.Window): ), scale=( 2.0 - if uiscale is bui.UIScale.SMALL + if uiscale is babase.UIScale.SMALL else 1.5 - if uiscale is bui.UIScale.MEDIUM + if uiscale is babase.UIScale.MEDIUM else 1.0 ), stack_offset=(0, 0) - if uiscale is bui.UIScale.SMALL + if uiscale is babase.UIScale.SMALL else (0, 0) - if uiscale is bui.UIScale.MEDIUM + if uiscale is babase.UIScale.MEDIUM else (0, 0), ) ) - self._done_button = bui.buttonwidget( + self._done_button = _bauiv1.buttonwidget( parent=self._root_widget, position=(self._width - 200, 44), size=(140, 60), autoselect=True, - label=bui.Lstr(resource='doneText'), + label=babase.Lstr(resource='doneText'), on_activate_call=self._done, ) - bui.containerwidget( + _bauiv1.containerwidget( edit=self._root_widget, on_cancel_call=self._cancel, start_button=self._done_button, ) - bui.textwidget( + _bauiv1.textwidget( parent=self._root_widget, position=(self._width * 0.5, self._height - 41), size=(0, 0), scale=0.95, text=label, maxwidth=self._width - 140, - color=bui.app.classic.ui.title_color, + color=babase.app.classic.ui.title_color, h_align='center', v_align='center', ) - self._text_field = bui.textwidget( + self._text_field = _bauiv1.textwidget( parent=self._root_widget, position=(70, self._height - 116), max_chars=max_chars, - text=cast(str, bui.textwidget(query=self._target_text)), + text=cast(str, _bauiv1.textwidget(query=self._target_text)), on_return_press_call=self._done, autoselect=True, size=(self._width - 140, 55), @@ -122,7 +130,7 @@ class OnScreenKeyboardWindow(bui.Window): key_color = self._key_color key_color_dark = self._key_color_dark - self._click_sound = bui.getsound('click01') + self._click_sound = _bauiv1.getsound('click01') # kill prev char keys for key in self._char_keys: @@ -137,21 +145,21 @@ class OnScreenKeyboardWindow(bui.Window): h = row_starts[row_num] # shift key before row 3 if row_num == 2 and self._shift_button is None: - self._shift_button = bui.buttonwidget( + self._shift_button = _bauiv1.buttonwidget( parent=self._root_widget, position=(h - key_width * 2.0, v), size=(key_width * 1.7, key_height), autoselect=True, textcolor=key_textcolor, color=key_color_dark, - label=bui.charstr(bui.SpecialChar.SHIFT), + label=babase.charstr(babase.SpecialChar.SHIFT), enable_sound=False, extra_touch_border_scale=0.3, button_type='square', ) for _ in row: - btn = bui.buttonwidget( + btn = _bauiv1.buttonwidget( parent=self._root_widget, position=(h, v), size=(key_width, key_height), @@ -171,7 +179,7 @@ class OnScreenKeyboardWindow(bui.Window): if self._backspace_button is not None: self._backspace_button.delete() - self._backspace_button = bui.buttonwidget( + self._backspace_button = _bauiv1.buttonwidget( parent=self._root_widget, position=(h + 4, v), size=(key_width * 1.8, key_height), @@ -180,7 +188,7 @@ class OnScreenKeyboardWindow(bui.Window): repeat=True, textcolor=key_textcolor, color=key_color_dark, - label=bui.charstr(bui.SpecialChar.DELETE), + label=babase.charstr(babase.SpecialChar.DELETE), button_type='square', on_activate_call=self._del, ) @@ -188,7 +196,7 @@ class OnScreenKeyboardWindow(bui.Window): # Do space bar and stuff. if row_num == 2: if self._num_mode_button is None: - self._num_mode_button = bui.buttonwidget( + self._num_mode_button = _bauiv1.buttonwidget( parent=self._root_widget, position=(112, v - 8), size=(key_width * 2, key_height + 5), @@ -201,7 +209,7 @@ class OnScreenKeyboardWindow(bui.Window): label='', ) if self._emoji_button is None: - self._emoji_button = bui.buttonwidget( + self._emoji_button = _bauiv1.buttonwidget( parent=self._root_widget, position=(56, v - 8), size=(key_width, key_height + 5), @@ -209,13 +217,13 @@ class OnScreenKeyboardWindow(bui.Window): enable_sound=False, textcolor=key_textcolor, color=key_color_dark, - label=bui.charstr(bui.SpecialChar.LOGO_FLAT), + label=babase.charstr(babase.SpecialChar.LOGO_FLAT), extra_touch_border_scale=0.3, button_type='square', ) btn1 = self._num_mode_button if self._space_button is None: - self._space_button = bui.buttonwidget( + self._space_button = _bauiv1.buttonwidget( parent=self._root_widget, position=(210, v - 12), size=(key_width * 6.1, key_height + 15), @@ -224,49 +232,51 @@ class OnScreenKeyboardWindow(bui.Window): autoselect=True, textcolor=key_textcolor, color=key_color_dark, - label=bui.Lstr(resource='spaceKeyText'), - on_activate_call=bui.Call(self._type_char, ' '), + label=babase.Lstr(resource='spaceKeyText'), + on_activate_call=babase.Call(self._type_char, ' '), ) # Show change instructions only if we have more than one # keyboard option. keyboards = ( - bui.app.meta.scanresults.exports_of_class(bui.Keyboard) - if bui.app.meta.scanresults is not None + babase.app.meta.scanresults.exports_of_class( + babase.Keyboard + ) + if babase.app.meta.scanresults is not None else [] ) if len(keyboards) > 1: - bui.textwidget( + _bauiv1.textwidget( parent=self._root_widget, h_align='center', position=(210, v - 70), size=(key_width * 6.1, key_height + 15), - text=bui.Lstr( + text=babase.Lstr( resource='keyboardChangeInstructionsText' ), scale=0.75, ) btn2 = self._space_button btn3 = self._emoji_button - bui.widget(edit=btn1, right_widget=btn2, left_widget=btn3) - bui.widget( + _bauiv1.widget(edit=btn1, right_widget=btn2, left_widget=btn3) + _bauiv1.widget( edit=btn2, left_widget=btn1, right_widget=self._done_button ) - bui.widget(edit=btn3, left_widget=btn1) - bui.widget(edit=self._done_button, left_widget=btn2) + _bauiv1.widget(edit=btn3, left_widget=btn1) + _bauiv1.widget(edit=self._done_button, left_widget=btn2) - bui.containerwidget( + _bauiv1.containerwidget( edit=self._root_widget, selected_child=self._char_keys[14] ) self._refresh() def _get_keyboard(self) -> bui.Keyboard: - assert bui.app.meta.scanresults is not None - classname = bui.app.meta.scanresults.exports_of_class(bui.Keyboard)[ - self._keyboard_index - ] - kbclass = bui.getclass(classname, bui.Keyboard) + assert babase.app.meta.scanresults is not None + classname = babase.app.meta.scanresults.exports_of_class( + babase.Keyboard + )[self._keyboard_index] + kbclass = babase.getclass(classname, babase.Keyboard) return kbclass() def _refresh(self) -> None: @@ -275,23 +285,23 @@ class OnScreenKeyboardWindow(bui.Window): chars = list(self._chars) if self._mode == 'caps': chars = [c.upper() for c in chars] - bui.buttonwidget( + _bauiv1.buttonwidget( edit=self._shift_button, color=self._key_color_lit if self._mode == 'caps' else self._key_color_dark, - label=bui.charstr(bui.SpecialChar.SHIFT), + label=babase.charstr(babase.SpecialChar.SHIFT), on_activate_call=self._shift, ) - bui.buttonwidget( + _bauiv1.buttonwidget( edit=self._num_mode_button, label='123#&*', on_activate_call=self._num_mode, ) - bui.buttonwidget( + _bauiv1.buttonwidget( edit=self._emoji_button, color=self._key_color_dark, - label=bui.charstr(bui.SpecialChar.LOGO_FLAT), + label=babase.charstr(babase.SpecialChar.LOGO_FLAT), on_activate_call=self._next_mode, ) else: @@ -299,21 +309,21 @@ class OnScreenKeyboardWindow(bui.Window): chars = list(self._keyboard.nums) else: chars = list(self._keyboard.pages[self._mode]) - bui.buttonwidget( + _bauiv1.buttonwidget( edit=self._shift_button, color=self._key_color_dark, label='', on_activate_call=self._null_press, ) - bui.buttonwidget( + _bauiv1.buttonwidget( edit=self._num_mode_button, label='abc', on_activate_call=self._abc_mode, ) - bui.buttonwidget( + _bauiv1.buttonwidget( edit=self._emoji_button, color=self._key_color_dark, - label=bui.charstr(bui.SpecialChar.LOGO_FLAT), + label=babase.charstr(babase.SpecialChar.LOGO_FLAT), on_activate_call=self._next_mode, ) @@ -324,7 +334,7 @@ class OnScreenKeyboardWindow(bui.Window): # No such char. have_char = False pagename = self._mode - if bui.do_once(): + if babase.do_once(): errstr = ( f'Size of page "{pagename}" of keyboard' f' "{self._keyboard.name}" is incorrect:' @@ -332,10 +342,10 @@ class OnScreenKeyboardWindow(bui.Window): f' (size of default "normal" page)' ) logging.error(errstr) - bui.buttonwidget( + _bauiv1.buttonwidget( edit=btn, label=chars[i] if have_char else ' ', - on_activate_call=bui.Call( + on_activate_call=babase.Call( self._type_char, chars[i] if have_char else ' ' ), ) @@ -360,20 +370,22 @@ class OnScreenKeyboardWindow(bui.Window): self._refresh() def _next_keyboard(self) -> None: - assert bui.app.meta.scanresults is not None - kbexports = bui.app.meta.scanresults.exports_of_class(bui.Keyboard) + assert babase.app.meta.scanresults is not None + kbexports = babase.app.meta.scanresults.exports_of_class( + babase.Keyboard + ) self._keyboard_index = (self._keyboard_index + 1) % len(kbexports) self._load_keyboard() if len(kbexports) < 2: - bui.getsound('error').play() - bui.screenmessage( - bui.Lstr(resource='keyboardNoOthersAvailableText'), + _bauiv1.getsound('error').play() + screenmessage( + babase.Lstr(resource='keyboardNoOthersAvailableText'), color=(1, 0, 0), ) else: - bui.screenmessage( - bui.Lstr( + screenmessage( + babase.Lstr( resource='keyboardSwitchText', subs=[('${NAME}', self._keyboard.name)], ), @@ -394,29 +406,29 @@ class OnScreenKeyboardWindow(bui.Window): def _del(self) -> None: self._click_sound.play() - txt = cast(str, bui.textwidget(query=self._text_field)) + txt = cast(str, _bauiv1.textwidget(query=self._text_field)) # pylint: disable=unsubscriptable-object txt = txt[:-1] - bui.textwidget(edit=self._text_field, text=txt) + _bauiv1.textwidget(edit=self._text_field, text=txt) def _type_char(self, char: str) -> None: self._click_sound.play() if char.isspace(): if ( - bui.apptime() - self._last_space_press + babase.apptime() - self._last_space_press < self._double_space_interval ): self._last_space_press = 0 self._next_keyboard() self._del() # We typed unneeded space around 1s ago. return - self._last_space_press = bui.apptime() + self._last_space_press = babase.apptime() # Operate in unicode so we don't do anything funky like chop utf-8 # chars in half. - txt = cast(str, bui.textwidget(query=self._text_field)) + txt = cast(str, _bauiv1.textwidget(query=self._text_field)) txt += char - bui.textwidget(edit=self._text_field, text=txt) + _bauiv1.textwidget(edit=self._text_field, text=txt) # If we were caps, go back only if not Shift is pressed twice. if self._mode == 'caps' and not self._double_press_shift: @@ -424,13 +436,13 @@ class OnScreenKeyboardWindow(bui.Window): self._refresh() def _cancel(self) -> None: - bui.getsound('swish').play() - bui.containerwidget(edit=self._root_widget, transition='out_scale') + _bauiv1.getsound('swish').play() + _bauiv1.containerwidget(edit=self._root_widget, transition='out_scale') def _done(self) -> None: - bui.containerwidget(edit=self._root_widget, transition='out_scale') + _bauiv1.containerwidget(edit=self._root_widget, transition='out_scale') if self._target_text: - bui.textwidget( + _bauiv1.textwidget( edit=self._target_text, - text=cast(str, bui.textwidget(query=self._text_field)), + text=cast(str, _bauiv1.textwidget(query=self._text_field)), ) diff --git a/tests/test_babase/__init__.py b/tests/test_base/__init__.py similarity index 100% rename from tests/test_babase/__init__.py rename to tests/test_base/__init__.py diff --git a/tests/test_babase/test_assetmanager.py b/tests/test_base/test_assetmanager.py similarity index 100% rename from tests/test_babase/test_assetmanager.py rename to tests/test_base/test_assetmanager.py diff --git a/tests/test_babase/test_imports.py b/tests/test_base/test_imports.py similarity index 72% rename from tests/test_babase/test_imports.py rename to tests/test_base/test_imports.py index 7a9ab1ca..7337debd 100644 --- a/tests/test_babase/test_imports.py +++ b/tests/test_base/test_imports.py @@ -10,11 +10,10 @@ from batools import testrun @pytest.mark.skipif( - testrun.test_runs_disabled(), - reason='Test app runs disabled here.', + testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason() ) -def test_babase_imports() -> None: - """Testing.""" +def test_imports() -> None: + """Test imports for our featureset.""" # Make sure our package and binary module can be cleanly imported by # themselves. diff --git a/tests/test_plus/__init__.py b/tests/test_plus/__init__.py new file mode 100644 index 00000000..867b1714 --- /dev/null +++ b/tests/test_plus/__init__.py @@ -0,0 +1 @@ +# Released under the MIT License. See LICENSE for details. diff --git a/tests/test_plus/test_imports.py b/tests/test_plus/test_imports.py new file mode 100644 index 00000000..52395188 --- /dev/null +++ b/tests/test_plus/test_imports.py @@ -0,0 +1,21 @@ +# Released under the MIT License. See LICENSE for details. +# +"""Testing asset manager functionality.""" + +from __future__ import annotations + +import pytest + +from batools import testrun + + +@pytest.mark.skipif( + testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason() +) +def test_imports() -> None: + """Test imports for our featureset.""" + + # Make sure our package and binary module can be cleanly imported by + # themselves. + testrun.run_command('import baplus') + testrun.run_command('import _baplus') diff --git a/tests/test_ui_v1/__init__.py b/tests/test_ui_v1/__init__.py new file mode 100644 index 00000000..867b1714 --- /dev/null +++ b/tests/test_ui_v1/__init__.py @@ -0,0 +1 @@ +# Released under the MIT License. See LICENSE for details. diff --git a/tests/test_ui_v1/test_imports.py b/tests/test_ui_v1/test_imports.py new file mode 100644 index 00000000..45727084 --- /dev/null +++ b/tests/test_ui_v1/test_imports.py @@ -0,0 +1,21 @@ +# Released under the MIT License. See LICENSE for details. +# +"""Testing asset manager functionality.""" + +from __future__ import annotations + +import pytest + +from batools import testrun + + +@pytest.mark.skipif( + testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason() +) +def test_imports() -> None: + """Test imports for our featureset.""" + + # Make sure our package and binary module can be cleanly imported by + # themselves. + testrun.run_command('import bauiv1') + testrun.run_command('import _bauiv1') diff --git a/tools/batools/featureset.py b/tools/batools/featureset.py index 3db11b97..6a361693 100644 --- a/tools/batools/featureset.py +++ b/tools/batools/featureset.py @@ -147,7 +147,7 @@ class FeatureSet: @property def name_python_package_tests(self) -> str: """The name of our Python tests package.""" - return f'test_ba{self.name_compact}' + return f'test_{self.name}' @property def name_python_binary_module(self) -> str: diff --git a/tools/batools/testrun.py b/tools/batools/testrun.py index 08b58334..37ab69cc 100755 --- a/tools/batools/testrun.py +++ b/tools/batools/testrun.py @@ -24,6 +24,12 @@ def test_runs_disabled() -> bool: return False +def test_runs_disabled_reason() -> str: + """Why are test runs disabled here?""" + # Can get more specific later. + return 'App test runs disabled here.' + + def get_binary() -> str: """Return a path to a server build binary, building it if need be."""