-
Notifications
You must be signed in to change notification settings - Fork 10
Add Initial unit tests #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f384152
c55f76f
b1aef50
9608e89
0fb61ea
238f075
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| ci: | ||
| name: Tests on Python ${{ matrix.python-version }} | ||
| runs-on: windows-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync | ||
|
|
||
| - name: Run type checks | ||
| run: uv run poe typecheck | ||
|
|
||
| - name: Run tests | ||
| run: uv run pytest |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Contributing | ||
|
|
||
| Thank you for your interest in contributing to construct-editor! | ||
|
|
||
| ## Project Setup | ||
|
|
||
| This project uses [uv](https://docs.astral.sh/uv/) for dependency management. Make sure you have `uv` installed before proceeding. | ||
|
|
||
| Clone the repository and install all dependencies (including dev dependencies) with: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/timrid/construct-editor.git | ||
| cd construct-editor | ||
| uv sync | ||
| ``` | ||
|
|
||
| This will create a virtual environment and install all required packages automatically. | ||
|
|
||
| ## Running the Example GUI | ||
|
|
||
| To launch the example GUI, run: | ||
|
|
||
| ```bash | ||
| uv run construct-editor | ||
| ``` | ||
|
|
||
| ## Running Tests | ||
|
|
||
| To run the test suite with [pytest](https://docs.pytest.org/): | ||
|
|
||
| ```bash | ||
| uv run pytest | ||
| ``` | ||
|
|
||
| ## Running Type Checks Locally | ||
|
|
||
| Type checks are run via [poethepoet](https://github.com/nat-n/poethepoet) and include [ruff](https://docs.astral.sh/ruff/), [ty](https://github.com/astral-sh/ty), and [pyright](https://github.com/microsoft/pyright): | ||
|
|
||
| ```bash | ||
| uv run poe typecheck | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,8 @@ construct-editor = "construct_editor.main:main" | |||||
| dev = [ | ||||||
| "poethepoet>=0.46.0", | ||||||
| "pyright>=1.1.410", | ||||||
| "pytest>=8.0.0", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| "pytest-mock>=3.14.0", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add |
||||||
| "ruff>=0.15.16", | ||||||
| "ty>=0.0.46", | ||||||
| "cryptography", # optional "extra" from construct that the user may or may not have installed | ||||||
|
|
@@ -85,6 +87,10 @@ include = [ | |||||
| [tool.setuptools.package-data] | ||||||
| construct_editor = ["py.typed"] | ||||||
|
|
||||||
| [tool.pytest.ini_options] | ||||||
| testpaths = ["tests"] | ||||||
| addopts = "-v" | ||||||
|
|
||||||
| [tool.pyright] | ||||||
| typeCheckingMode = "strict" | ||||||
| exclude = [ | ||||||
|
|
@@ -167,6 +173,9 @@ ignore = [ | |||||
| "F841", # Local variable `...` is assigned to but never used | ||||||
| ] | ||||||
|
|
||||||
| [tool.uv] | ||||||
| system-certs = true | ||||||
|
|
||||||
| [tool.poe.tasks.typecheck] | ||||||
| sequence = [ | ||||||
| { cmd = "ruff check --fix --show-fixes" }, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # -*- coding: utf-8 -*- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is Python default. Why add the explicit markers? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you certain that this enhances readability?