Add Initial unit tests#40
Open
timrid wants to merge 6 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an initial pytest-based unit test suite and a GitHub Actions CI workflow to run type checks and tests, while also applying a few small wxPython-related fixes/typing adjustments in the widget layer.
Changes:
- Add initial
tests/suite (core logic tests + wx-widget placeholders) and pytest configuration. - Add a Windows CI workflow running
uv sync,poe typecheck, andpytestacross a Python-version matrix. - Apply minor wx-related fixes/typing tweaks in several wx widget modules and in
core/entries.pycontext-menu imports.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds locked dev dependencies for pytest/pytest-mock (and transitive deps). |
| pyproject.toml | Adds pytest dev deps, pytest config (testpaths, addopts), and tool.uv setting. |
| CONTRIBUTORS.md | Documents uv-based setup and how to run tests/typechecks. |
| .github/workflows/ci.yml | Adds CI workflow to run type checks and pytest on Windows across Python versions. |
| construct_editor/wx_widgets/wx_python_code_editor.py | Fixes SetSelBackground call to use a boolean. |
| construct_editor/wx_widgets/wx_obj_view.py | Fixes wx.TextCtrl initialization (avoids incorrect super(wx.TextCtrl, self)). |
| construct_editor/wx_widgets/wx_hex_editor.py | Minor wx constant/typing fixes and safer handling of startValue. |
| construct_editor/wx_widgets/wx_construct_editor.py | Tightens typing around GetParent() and adds a type-ignore for overload mismatch. |
| construct_editor/core/entries.py | Switches context-menu imports to module-qualified usage to simplify typing/imports. |
| tests/init.py | Adds tests package marker. |
| tests/core/init.py | Adds tests.core package marker. |
| tests/core/test_preprocessor.py | Adds tests for metadata instrumentation helpers. |
| tests/core/test_model.py | Adds enum/index tests for core model types. |
| tests/core/test_entries.py | Adds tests for parsing/format helpers and path formatting. |
| tests/core/test_custom.py | Adds smoke tests for custom construct registration APIs. |
| tests/core/test_context_menu.py | Adds tests for context-menu dataclasses and callbacks. |
| tests/core/test_construct_editor.py | Adds placeholder (skipped) tests for abstract ConstructEditor contract. |
| tests/core/test_commands.py | Adds tests for core command processor undo/redo behavior. |
| tests/core/test_callbacks.py | Adds tests for CallbackList. |
| tests/wx_widgets/init.py | Adds wx_widgets test package marker. |
| tests/wx_widgets/conftest.py | Adds session-scoped wx.App and a wx.Frame fixture for widget tests. |
| tests/wx_widgets/test_wx_python_code_editor.py | Adds placeholder (skipped) tests for code editor widget. |
| tests/wx_widgets/test_wx_obj_view.py | Adds placeholder (skipped) tests for object view/editor widgets. |
| tests/wx_widgets/test_wx_hex_editor.py | Adds a couple non-placeholder tests for HexEditorFormat and placeholders for wx-dependent parts. |
| tests/wx_widgets/test_wx_exception_dialog.py | Adds a non-placeholder test for ExceptionInfo plus a skipped dialog placeholder. |
| tests/wx_widgets/test_wx_context_menu.py | Adds placeholder (skipped) tests for wx context menu. |
| tests/wx_widgets/test_wx_construct_hex_editor.py | Adds placeholder (skipped) tests for construct hex editor widgets. |
| tests/wx_widgets/test_wx_construct_editor.py | Adds placeholder (skipped) tests for wx construct editor/model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
+12
| import pytest | ||
|
|
||
| pytestmark = pytest.mark.usefixtures("wx_app") | ||
|
|
||
|
|
||
| class TestHexEditorFormat: |
Comment on lines
+7
to
+12
| import pytest | ||
|
|
||
| pytestmark = pytest.mark.usefixtures("wx_app") | ||
|
|
||
|
|
||
| class TestExceptionInfo: |
Comment on lines
+57
to
+60
| def test_invalid_string_raises(self) -> None: | ||
| with pytest.raises(Exception): | ||
| str_to_int("not_a_number") | ||
|
|
Comment on lines
+73
to
+76
| def test_invalid_hex_raises(self) -> None: | ||
| with pytest.raises(Exception): | ||
| str_to_bytes("zz") | ||
|
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds AI generated initial unit-test and a CI test pipeline. It only acts as a first smoke test for e.g. some import errors. The test files has to be filled in the future.