Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
574bd73
feat(infra): add syncAddonWithTemplate.py script and unit test suite
abdel792 Aug 4, 2026
3553ac3
test(sync): update testFormatAuthorList for PEP 621 compliance
abdel792 Aug 4, 2026
bc4816d
docs(unitTesting): clarify testFormatAuthorList email omission in doc…
abdel792 Aug 4, 2026
241ee9a
test(infra): adjust test package docstrings and remove redundant sani…
abdel792 Aug 5, 2026
81b9779
fix(sync): normalize package names and bootstrap `.addonmergeignore`
abdel792 Aug 5, 2026
f64404c
test(sync): make `load_tests` sorting robust against inherited methods
abdel792 Aug 5, 2026
a8ef694
docs(sync): fix unit test path and CLI usage examples
abdel792 Aug 5, 2026
87372e5
test: add unit tests and documentation for .addonmergeignore
abdel792 Aug 5, 2026
4cbab17
tests(template): add missing trailing newline to test_syncAddonWithTe…
abdel792 Aug 6, 2026
57c1819
docs: restore AddonTemplate URL casing and remove test suite details
abdel792 Aug 6, 2026
f8cd032
refactor(syncAddonTool): modularize architecture and improve unit tests
abdel792 Aug 9, 2026
e073bd9
docs(managementFromGit): update documentation for syncAddonTool and s…
abdel792 Aug 9, 2026
723d869
build(lint): exclude syncAddonTool folder and syncAddonTool.spec file…
abdel792 Aug 9, 2026
9a4afbe
build: ignore PyInstaller output directories
abdel792 Aug 9, 2026
c48885b
fix(sync): remove extra empty lines in generated TOML files
abdel792 Aug 9, 2026
d6a6050
style(sync): add trailing empty line to some files
abdel792 Aug 9, 2026
8e3c1f4
- Remove obsolete `syncAddonWithTemplate.py` top-level script.
abdel792 Aug 11, 2026
7c7b92e
Update docs/managementFromGit/updatingExistingAddons.md to document
abdel792 Aug 11, 2026
9701532
docs: remove invalid -m script syntax in syncAddonTool usage examples
abdel792 Aug 11, 2026
9abf590
docs(cli): document -v/--verbose flag and refine debug logging
abdel792 Aug 12, 2026
8f8694b
fix(logging): include full TOML section path in list merge debug logs
abdel792 Aug 12, 2026
4319d23
Merge branch 'master' into syncAddon
abdel792 Aug 13, 2026
557d209
Merge branch 'master' into syncAddon
abdel792 Aug 25, 2026
bfea2ef
docs: fix formatting and outdated descriptions in updatingExistingAdd…
abdel792 Sep 19, 2026
70b65c1
docs: update unit testing documentation for syncAddonTool
abdel792 Sep 19, 2026
14a8a64
build: remove unused pathspec hidden import from PyInstaller spec
abdel792 Sep 19, 2026
5e530b7
build: revert pyright version update in pyproject.toml
abdel792 Sep 19, 2026
df66e27
Merge branch 'master' into syncAddon
abdel792 Sep 19, 2026
fe32093
Merge branch 'master' into syncAddon
abdel792 Oct 1, 2026
3887d58
fix(astUtils): preserve non-constant unparsed AST expressions in dict…
abdel792 Oct 1, 2026
495969a
fix(buildVarsSync): re-raise SyntaxError on corrupted buildVars.py pa…
abdel792 Oct 1, 2026
cf1dff5
fix(engine): enforce implicit .addonmergeignore protection and fnmatc…
abdel792 Oct 1, 2026
c13f4db
fix(pyproject): improve URL mapping, dependency version parsing, and …
abdel792 Oct 1, 2026
268001f
fix(cli): ensure nonzero exit status on execution or backup failures
abdel792 Oct 1, 2026
e3a42c7
docs(syncAddonTool): explain --no-project flag utility for running ou…
abdel792 Oct 1, 2026
8dc4795
buildVarsSync: preserve quote style during merge and add unit test
abdel792 Oct 1, 2026
c96c565
Merge branch 'master' into syncAddon
abdel792 Oct 9, 2026
27e428a
Docs(updatingExistingAddons.md): replace AddonTemplate with camelCase…
abdel792 Oct 9, 2026
a571d30
Docs(updatingExistingAddons.md): capitalize Chore in example commit m…
abdel792 Oct 9, 2026
1666570
Docs(updatingExistingAddons.md): clarify executable usage instructions
abdel792 Oct 9, 2026
5daf1d7
Docs(updatingExistingAddons.md): replace GitHub callout and clean for…
abdel792 Oct 9, 2026
2ed5002
Docs(unitTesting.md): fix code block language syntax spaces
abdel792 Oct 9, 2026
abc1b28
Style(__main__.py): convert space indentation to tabs
abdel792 Oct 9, 2026
2003150
Merge branch 'master' into syncAddon
abdel792 Oct 14, 2026
0ea3b28
test(e2e): add E2E testing infrastructure, migrate buildVars tests, a…
abdel792 Oct 14, 2026
8dbbe52
ci(workflow): switch test runner from ubuntu-latest to windows-latest
abdel792 Oct 14, 2026
c21773b
fix(buildVarsSync): escape control characters in double-quoted literals
abdel792 Oct 15, 2026
3bdaed6
fix(buildVarsSync): handle annotated addon_info assignments
abdel792 Oct 15, 2026
caff4a7
fix(buildVarsSync): preserve non-literal metadata expressions
abdel792 Oct 15, 2026
d7d0830
fix(buildVarsSync): preserve required imports for global expressions
abdel792 Oct 15, 2026
44107a3
fix(engine): honor custom exclusions during configuration merges
abdel792 Oct 16, 2026
e83a9e2
fix(pyproject): restrict requirement matching to dependency arrays
abdel792 Oct 16, 2026
23053bf
fix(pyproject): purge static fields from merged dynamic metadata
abdel792 Oct 16, 2026
03e6772
fix(buildVarsSync): preserve i18nSources during build variable extrac…
abdel792 Oct 16, 2026
f0586d7
fix(engine): match directory exclusions with trailing separators
abdel792 Oct 16, 2026
5afd6a7
fix(pyproject): populate repository metadata before merging template …
abdel792 Oct 16, 2026
fc1e8f4
test(e2e): use temporary paths for PyInstaller packaging test
abdel792 Oct 16, 2026
e216281
Merge branch 'master' into syncAddon
abdel792 Oct 16, 2026
68c092e
docs(updating-addons): replace git clean -f with safer staging command
abdel792 Oct 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .addonmergeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Files and directories ignored during template synchronization
.addonmergeignore
372 changes: 298 additions & 74 deletions docs/managementFromGit/updatingExistingAddons.md

Large diffs are not rendered by default.

41 changes: 36 additions & 5 deletions docs/unitTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,47 @@

This template provides a built-in unit testing structure powered by Python's standard `unittest` framework.

Ensuring your add-on and tooling behavior remains consistent during development and following template updates is done through automated unit testing.

## Running Tests Locally

To run the unit test suite locally using `uv`:
For unit tests to execute successfully, target modules (such as `syncAddonWithTemplate.py`) must be located at the root of the repository as sibling files to the `tests/` directory (at the same hierarchical level). This ensures Python's module discovery properly imports scripts when `unittest` runs from the project root.
Comment thread
abdel792 marked this conversation as resolved.
Outdated

### Run the Full Test Suite

To run the entire unit test suite with automatic test discovery and detailed output for every executed test case:

``` bash
Comment thread
abdel792 marked this conversation as resolved.
Outdated
uv run python -m unittest discover -s tests -v
```

Or execute tests for a specific file:
Here is what each part of the command does:
* `uv run`: Executes the command within the virtual environment managed by `uv`.
* `python -m unittest discover`: Automatically finds and runs all test files (matching `test*.py`) within the specified test directory.
* `-s tests`: Sets the start directory for test discovery to the `tests/` folder.
* `-v`: Enables verbose output, displaying the status and description of each test method individually.

``` bash
uv run python -m unittest -v tests/unit/template/test_sanity.py
```
### Run Specific Test Suites

You can run individual test modules during development by specifying their path:

* **Add-on Synchronization Tool Tests:**
``` bash
Comment thread
abdel792 marked this conversation as resolved.
Outdated
uv run python -m unittest -v tests/unit/template/test_syncAddonWithTemplate.py
```

---

## Synchronization Tool Test Suite Overview (`test_syncAddonWithTemplate.py`)
Comment thread
abdel792 marked this conversation as resolved.
Outdated

The unit test suite covers key logic in `syncAddonWithTemplate.py`, ensuring AST-based config merges, file parsing, and formatting behave predictably across project updates:

* **`testMergeLegacyBuildvarsWithOfficialTemplate`**: Validates the AST-based migration of legacy dictionary-based `buildVars.py` files into the official modern `AddonInfo` class structure.
* **`testMergeModernBuildvarsMissingSpeechDictionaries`**: Ensures that missing modern attributes (like `speechDictionaries`) are injected into existing `buildVars.py` files without overwriting present configurations.
* **`testSetupAddonMergeIgnore`**: Verifies that `.addonmergeignore` is automatically bootstrapped from the template if missing, preserved if already present, and left untouched during dry-run executions.
* **`testAddonMergeIgnore`**: Confirms that files and patterns specified in `.addonmergeignore` are strictly excluded from being overwritten during full add-on synchronization.
* **`testMergeBuildvarsAutoImportsOs`**: Confirms that `import os` is automatically prepended at the top of the merged `buildVars.py` file if any merged variable uses functions from the `os` module (e.g., `os.path.join`).
* **`testFixTomlIndentation`**: Verifies that 4-space indentations are correctly converted into tabs inside `maintainers` or `authors` TOML array blocks while leaving other sections untouched.
* **`testFormatAuthorList`**: Tests parsing of raw author strings (such as `"Name <email>"`) into `tomlkit` array objects with structured `name` and `email` key-value pairs, ensuring empty `email` fields are omitted for PEP 621 compliance.
* **`testMergeDependencyLists`**: Checks that dependency lists are merged intelligently by base package name, updating outdated tool versions while preserving custom user dependencies.
* **`testMergePyprojectTomlIntelligent`**: Verifies that `pyproject.toml` files are merged using `tomlkit` without creating duplicate dependencies or clobbering existing configuration sections.
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ Repository = "https://github.com/nvaccess/addonTemplate"
# PEP 735 dependency groups. `uv sync` installs the `dev` group by default, which
# pulls in every tool needed to build, translate, and lint the add-on.
[dependency-groups]
# Build add-on
# Build add-on & repository synchronization machinery
build = [
"scons==4.10.1",
"Markdown==3.10",
"tomlkit==0.15.0",
]
# Translations management
l10n = [
Expand All @@ -48,7 +49,7 @@ lint = [
"uv==0.11.15",
"ruff==0.14.5",
"prek==0.4.8",
"pyright[nodejs]==1.1.407",
"pyright[nodejs]==1.1.411",
Comment thread
abdel792 marked this conversation as resolved.
Outdated
Comment thread
abdel792 marked this conversation as resolved.
Outdated
]
dev = [
{ include-group = "build" },
Expand Down Expand Up @@ -80,6 +81,7 @@ exclude = [
"__pycache__",
".venv",
"buildVars.py",
"syncAddonWithTemplate.py",
"tests",
]

Expand Down Expand Up @@ -119,6 +121,7 @@ exclude = [
".venv",
"site_scons",
".github/scripts",
"syncAddonWithTemplate.py",
"tests",
# When excluding concrete paths relative to a directory,
# not matching multiple folders by name e.g. `__pycache__`,
Expand Down Expand Up @@ -228,3 +231,6 @@ reportMissingTypeStubs = false

# Bad rules
# These are sorted alphabetically and should be enabled and moved to compliant rules section when resolved.

[tool.setuptools]
py-modules = []
Loading