Skip to content

Add Initial unit tests#40

Open
timrid wants to merge 6 commits into
mainfrom
initial-unit-tests
Open

Add Initial unit tests#40
timrid wants to merge 6 commits into
mainfrom
initial-unit-tests

Conversation

@timrid

@timrid timrid commented Jun 10, 2026

Copy link
Copy Markdown
Owner

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and pytest across a Python-version matrix.
  • Apply minor wx-related fixes/typing tweaks in several wx widget modules and in core/entries.py context-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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants