refactor fiona src to have single module
This commit is contained in:
-19
@@ -1,19 +0,0 @@
|
||||
[run]
|
||||
source = src
|
||||
omit =
|
||||
src/tests/*
|
||||
*/tests/*
|
||||
*/test_*.py
|
||||
src/mdoctor/fmlint.py
|
||||
src/python_ruff/pycustomlint.py
|
||||
src/llm-wiki/__init__.py
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
pragma: no cover
|
||||
def __repr__
|
||||
raise AssertionError
|
||||
raise NotImplementedError
|
||||
if __name__ == .__main__.:
|
||||
if TYPE_CHECKING:
|
||||
@abstractmethod
|
||||
@@ -35,6 +35,7 @@ dist/
|
||||
|
||||
# Coverage
|
||||
.coverage
|
||||
coverage.xml
|
||||
htmlcov/
|
||||
|
||||
# Jupyter Notebook checkpoints
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Fiona-Assistant Agent Rules
|
||||
version: 1.4.1
|
||||
version: 1.5.0
|
||||
title: LLM Agent Rules
|
||||
type: summary
|
||||
created: 2025-09-23
|
||||
@@ -57,7 +57,7 @@ Fiona-Assistant repository.
|
||||
|
||||
Refer to rules in this file as `project agent rule N.M` (e.g.
|
||||
`project agent rule 1.1`) to differentiate them from rules in other
|
||||
AGENTS.md files (e.g. the llm-wiki template's `src/llm-wiki/AGENTS.md`).
|
||||
AGENTS.md files (e.g. the llm-wiki template's `src/fiona/data/llm_wiki/AGENTS.md`).
|
||||
|
||||
---
|
||||
|
||||
@@ -82,7 +82,7 @@ Before step 2, load the environment (project agent rule 3.1).
|
||||
(project agent rule 6.1). Leave production code unchanged in
|
||||
this step.
|
||||
3. **Implement, TDD style.** Load the
|
||||
[python-tdd skill](./src/llm-wiki/utils/skills/python-tdd/SKILL.md)
|
||||
[python-tdd skill](./src/fiona/data/llm_wiki/utils/skills/python-tdd/SKILL.md)
|
||||
(project agent rule 4.1).
|
||||
- Red: run the new tests and confirm they fail.
|
||||
- Green: write the smallest change that makes them pass.
|
||||
@@ -94,8 +94,8 @@ Before step 2, load the environment (project agent rule 3.1).
|
||||
task. Move status along `Planned` ->
|
||||
`Partially Implemented` -> `Implemented`, or set
|
||||
`Won't Do` when the requirement is rejected.
|
||||
- Run `python src/run_tests.py`, then
|
||||
`python src/run_sanity.py --non-interactive`. Both pass
|
||||
- Run `python scripts/run_tests.py`, then
|
||||
`python scripts/run_sanity.py --non-interactive`. Both pass
|
||||
(project agent rule 2.2).
|
||||
5. **Bump versions.** On each markdown file this task edited,
|
||||
bump frontmatter `version` and set `updated` to the edit date
|
||||
@@ -111,10 +111,10 @@ bumps versions (step 5). It skips the test and implementation steps.
|
||||
|
||||
### 2.2 Testing
|
||||
|
||||
- For testing scripts always run `python src/run_tests.py` and make sure
|
||||
- For testing scripts always run `python scripts/run_tests.py` and make sure
|
||||
everything is passing on every loop
|
||||
- After modifying the repo, make sure
|
||||
`python src/run_sanity.py --non-interactive` passes before finalizing.
|
||||
`python scripts/run_sanity.py --non-interactive` passes before finalizing.
|
||||
|
||||
### 2.3 Documentation
|
||||
|
||||
@@ -178,12 +178,12 @@ dependency conflicts, incorrect Python versions, or missing packages.
|
||||
### 4.1 Load Python TDD Skill for Python Tasks
|
||||
|
||||
> When modifying or creating Python scripts, the
|
||||
> [python-tdd skill](./src/llm-wiki/utils/skills/python-tdd/SKILL.md)
|
||||
> [python-tdd skill](./src/fiona/data/llm_wiki/utils/skills/python-tdd/SKILL.md)
|
||||
> MUST be loaded
|
||||
|
||||
```text
|
||||
SKILL: python-tdd
|
||||
PATH: src/llm-wiki/utils/skills/python-tdd/SKILL.md
|
||||
PATH: src/fiona/data/llm_wiki/utils/skills/python-tdd/SKILL.md
|
||||
```
|
||||
|
||||
- Project Rules:
|
||||
@@ -222,22 +222,25 @@ The repository has the following structure with specific permissions:
|
||||
|
||||
```text
|
||||
fiona-assistant/
|
||||
├── src/ # Source code
|
||||
│ ├── llm-wiki/ # Packaged llm-wiki template (data only)
|
||||
│ │ # Structure source of truth:
|
||||
│ │ # `src/llm-wiki/wiki/schema.md`
|
||||
│ ├── fiona/ # Main CLI package
|
||||
├── src/fiona/ # The only installable package
|
||||
│ ├── __main__.py # CLI entry point
|
||||
│ ├── librarian/ # Wiki content management
|
||||
│ ├── mdoctor/ # Markdown diagnosis
|
||||
│ ├── python_ruff/ # Python code linting
|
||||
│ ├── wiki/ # Wiki lifecycle modules (init, update)
|
||||
│ ├── tests/ # Unit tests
|
||||
│ ├── run_tests.py # Test runner
|
||||
│ ├── run_sanity.py # Sanity runner (tests + linters)
|
||||
│ ├── customlinter/ # Frontmatter, markdown, Python, JSON linters
|
||||
│ ├── python_ruff/ # Ruff wrapper
|
||||
│ ├── gittool/ # Git operations
|
||||
│ ├── sanity_runner/ # Shared sanity engine
|
||||
│ ├── wiki/ # Wiki lifecycle (init, update, sanity, graph)
|
||||
│ ├── data/llm_wiki/ # Packaged template (data only)
|
||||
│ ├── run_tests.py # Test runner module
|
||||
│ └── run_sanity.py # Sanity runner module
|
||||
├── tests/ # Unit tests (not installed)
|
||||
├── scripts/ # Repo tooling, not package source
|
||||
│ ├── run_tests.py # Launcher for fiona.run_tests
|
||||
│ ├── run_sanity.py # Launcher for fiona.run_sanity
|
||||
│ ├── settings_dev.json # Development settings
|
||||
│ ├── utils.sh # Shell utilities
|
||||
│ └── install_packages.sh # Dependency installer
|
||||
│
|
||||
├── pyproject.toml # Project configuration
|
||||
├── bootstrap # Environment setup (bash; source it)
|
||||
├── bootstrap.ps1 # Environment setup (PowerShell; dot-source it)
|
||||
@@ -245,7 +248,7 @@ fiona-assistant/
|
||||
```
|
||||
|
||||
The llm-wiki directory structure is not duplicated here:
|
||||
`src/llm-wiki/wiki/schema.md` is the final source of truth for the
|
||||
`src/fiona/data/llm_wiki/wiki/schema.md` is the final source of truth for the
|
||||
llm-wiki directory structure.
|
||||
|
||||
**General Rules:**
|
||||
@@ -254,8 +257,8 @@ llm-wiki directory structure.
|
||||
- `/raw/` directories are **READ-ONLY** - Never edit archived source materials
|
||||
- `/wiki/concepts/` is **READ-WRITE** - Place synthesized content here
|
||||
- `/ingest/` is for **input processing** - Parse files dropped here
|
||||
- **Always update** `src/llm-wiki/wiki/index.md` when adding new concepts
|
||||
- **Always append** to `src/llm-wiki/wiki/log.md` for every action
|
||||
- **Always update** `src/fiona/data/llm_wiki/wiki/index.md` when adding new concepts
|
||||
- **Always append** to `src/fiona/data/llm_wiki/wiki/log.md` for every action
|
||||
|
||||
---
|
||||
|
||||
@@ -274,7 +277,7 @@ Steps 2 and 3 of project agent rule 2.1.
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
python src/run_tests.py
|
||||
python scripts/run_tests.py
|
||||
|
||||
# Run with pytest directly
|
||||
python -m pytest
|
||||
@@ -283,7 +286,7 @@ python -m pytest
|
||||
python -m pytest --cov=src
|
||||
|
||||
# Run specific test file
|
||||
python -m pytest src/tests/test_md_frontmatter.py -v
|
||||
python -m pytest tests/test_md_frontmatter.py -v
|
||||
```
|
||||
|
||||
**Test File Structure:**
|
||||
@@ -367,10 +370,10 @@ Before step 2 of that lifecycle:
|
||||
1. Set up the environment (project agent rule 3.1).
|
||||
2. Load the skill when the task needs one (project agent rule 4.1).
|
||||
Python tasks load the
|
||||
[python-tdd skill](./src/llm-wiki/utils/skills/python-tdd/SKILL.md).
|
||||
[python-tdd skill](./src/fiona/data/llm_wiki/utils/skills/python-tdd/SKILL.md).
|
||||
Wiki tasks load the
|
||||
[Fiona skill](./src/llm-wiki/utils/skills/fiona/SKILL.md)
|
||||
unless `src/llm-wiki/AGENTS.md` already loaded it.
|
||||
[Fiona skill](./src/fiona/data/llm_wiki/utils/skills/fiona/SKILL.md)
|
||||
unless `src/fiona/data/llm_wiki/AGENTS.md` already loaded it.
|
||||
|
||||
---
|
||||
|
||||
@@ -486,14 +489,14 @@ These rules **CAN** be overridden by:
|
||||
| Task | Required Action |
|
||||
| ---- | -------------- |
|
||||
| Development | project agent rule 2.1, in order |
|
||||
| Any Python work | Load the [python-tdd skill](./src/llm-wiki/utils/skills/python-tdd/SKILL.md) |
|
||||
| Any Python work | Load the [python-tdd skill](./src/fiona/data/llm_wiki/utils/skills/python-tdd/SKILL.md) |
|
||||
| Before testing | `source bootstrap` (Windows: `. .\bootstrap.ps1`) |
|
||||
| Step 1 | Write or check [SPEC](./SPEC.md) |
|
||||
| Step 2 and 3 | Failing tests, then the smallest change |
|
||||
| Step 4 | Re-read the spec; tests and sanity pass |
|
||||
| Step 5 | Bump `version` and `updated` on edited markdown |
|
||||
| Before commit | Run tests + linters |
|
||||
| Wiki changes | Load the [Fiona skill](./src/llm-wiki/utils/skills/fiona/SKILL.md); update index.md + log.md |
|
||||
| Wiki changes | Load the [Fiona skill](./src/fiona/data/llm_wiki/utils/skills/fiona/SKILL.md); update index.md + log.md |
|
||||
| Frontmatter | Include name, version, title, dates |
|
||||
| Errors | Raise exceptions, don't fail silently |
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ consistent, parseable structures that LLMs can easily read and process.
|
||||
|
||||
### Wiki Structure Support
|
||||
|
||||
Fiona-Assistant understands and maintains the [LLM Wiki directory structure](./llm-wiki/AGENTS.md):
|
||||
Fiona-Assistant understands and maintains the [LLM Wiki directory structure](./src/fiona/data/llm_wiki/AGENTS.md):
|
||||
|
||||
```text
|
||||
llm-wiki/
|
||||
@@ -258,39 +258,26 @@ Definitions:
|
||||
|
||||
```text
|
||||
fiona-assistant/
|
||||
├── llm-wiki/ # Wiki content and structure definition
|
||||
│ ├── AGENTS.md # Agent rules and directory permissions
|
||||
│ ├── ingest/ # Input zone for new content
|
||||
│ ├── raw/ # Archived source materials
|
||||
│ ├── wiki/ # Processed concept notes
|
||||
│ └── utils/ # Utility scripts
|
||||
│
|
||||
├── src/
|
||||
│ ├── fiona/ # Main CLI entry point
|
||||
│ │ └── __main__.py # Unified command dispatcher
|
||||
│ │
|
||||
├── src/fiona/ # Installable package
|
||||
│ ├── __main__.py # Unified command dispatcher
|
||||
│ ├── librarian/ # Wiki content management
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── librarian.py # File scanning and listing
|
||||
│ │ └── toc_generator.py # Table of contents generator
|
||||
│ │
|
||||
│ ├── mdoctor/ # Markdown diagnosis
|
||||
│ │ ├── __init__.py
|
||||
│ │ └── mdoctor.py # PyMarkdown lint wrapper
|
||||
│ │
|
||||
│ ├── python_ruff/ # Python code linting
|
||||
│ │ ├── __init__.py
|
||||
│ │ └── python_ruff.py # Ruff lint wrapper
|
||||
│ │
|
||||
│ ├── tests/ # Unit tests
|
||||
│ │ ├── test_fiona_main.py
|
||||
│ │ ├── test_librarian.py
|
||||
│ │ ├── test_mdoctor.py
|
||||
│ │ └── test_python_ruff.py
|
||||
│ │
|
||||
│ ├── run_tests.py # Test runner
|
||||
│ └── README.md # Development documentation
|
||||
│
|
||||
│ ├── customlinter/ # Custom linters
|
||||
│ ├── gittool/ # Git operations
|
||||
│ ├── sanity_runner/ # Shared sanity engine
|
||||
│ ├── wiki/ # Wiki lifecycle
|
||||
│ └── data/llm_wiki/ # Packaged wiki template
|
||||
│ ├── AGENTS.md # Agent rules and directory permissions
|
||||
│ ├── ingest/ # Input zone for new content
|
||||
│ ├── raw/ # Archived source materials
|
||||
│ ├── wiki/ # Processed concept notes
|
||||
│ └── utils/ # Utility scripts
|
||||
├── tests/ # Unit tests (not installed)
|
||||
├── scripts/ # Repo tooling (not installed)
|
||||
│ ├── run_tests.py
|
||||
│ ├── run_sanity.py
|
||||
│ └── settings_dev.json
|
||||
├── pyproject.toml # Project configuration
|
||||
├── bootstrap # Environment setup script (bash)
|
||||
├── bootstrap.ps1 # Environment setup script (PowerShell)
|
||||
@@ -306,13 +293,13 @@ fiona-assistant/
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
python src/run_tests.py
|
||||
python scripts/run_tests.py
|
||||
|
||||
# Or use pytest directly
|
||||
python -m pytest
|
||||
|
||||
# Run with coverage
|
||||
python -m pytest --cov=src
|
||||
python -m pytest --cov=src/fiona
|
||||
```
|
||||
|
||||
---
|
||||
@@ -341,7 +328,7 @@ GPL-3.0-only
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [LLM Wiki Agent Rules](./llm-wiki/AGENTS.md) - Directory permissions and workflow rules
|
||||
- [LLM Wiki Agent Rules](./src/fiona/data/llm_wiki/AGENTS.md) - Directory permissions and workflow rules
|
||||
- [Development Setup](./src/README.md) - Detailed development information
|
||||
- [Project Specification](./SPEC.md) - Feature spec sheet with requirements and acceptance criteria
|
||||
- [Project TODO](./todo.md) - Roadmap and planned features
|
||||
@@ -358,7 +345,7 @@ GPL-3.0-only
|
||||
| Check Python lint | `fiona-assistant python-ruff chklint /path/to/dir` |
|
||||
| Generate TOC | `generate-toc /path/to/dir --recursive-toc` |
|
||||
| Generate file TOC | `fiona-assistant librarian toc file /path/to/file.md --sectionized` |
|
||||
| Run tests | `python src/run_tests.py` |
|
||||
| Run tests | `python scripts/run_tests.py` |
|
||||
| Install | `pip install fiona-assistant` |
|
||||
| Dev install | `pip install -e .` |
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Fiona-Assistant Specification
|
||||
version: 0.40.5
|
||||
version: 0.41.0
|
||||
title: Project Spec Sheet
|
||||
created: 2026-09-23
|
||||
updated: 2026-09-29
|
||||
@@ -80,7 +80,8 @@ Implemented`, `Planned`, and `Won't Do`.
|
||||
|
||||
Revision 0.40.0 reorganizes the sheet into contracts. Revision 0.40.1
|
||||
numbers nested requirements such as `7.16.1.1`. Revision 0.40.4 adds
|
||||
the PYC001 exception in *6.4.2.*.
|
||||
the PYC001 exception in *6.4.2.*. Revision 0.41.0 installs one
|
||||
`fiona` package and keeps tests and repo scripts outside it.
|
||||
|
||||
Each feature section starts with a `Status` line. Requirements use
|
||||
`- *N.M.K.*`. Each `*acceptance*` sits under the requirement it tests.
|
||||
@@ -134,8 +135,8 @@ These apply to every feature.
|
||||
- *acceptance*: `wiki update` leaves every file under `personal/`
|
||||
and `raw/` byte-for-byte unchanged.
|
||||
- *1.2.4.* Code changes follow test-first development.
|
||||
`python src/run_tests.py` is green, then
|
||||
`python src/run_sanity.py` is green, before a change is finished.
|
||||
`python scripts/run_tests.py` is green, then
|
||||
`python scripts/run_sanity.py` is green, before a change is finished.
|
||||
- *acceptance*: A sanity run below the coverage gate in section 5.2
|
||||
fails even when every test passes.
|
||||
- *1.2.5.* Python passes Ruff. Markdown passes PyMarkdown with the
|
||||
@@ -149,8 +150,9 @@ These apply to every feature.
|
||||
|
||||
> Status: Implemented
|
||||
|
||||
Python `>= 3.8`. Install with `pip install -e .` from the repository
|
||||
root. Runtime dependencies:
|
||||
Python `>= 3.11` (also 3.12 and 3.13). Install with `pip install -e .`
|
||||
from the repository root. The build requires setuptools 61 or newer.
|
||||
Runtime dependencies:
|
||||
|
||||
| Package | Minimum |
|
||||
| --- | --- |
|
||||
@@ -158,31 +160,34 @@ root. Runtime dependencies:
|
||||
| ruff | 0.16.8 |
|
||||
| pyyaml | 6.0.3 |
|
||||
| GitPython | 3.1.0 |
|
||||
| pylint | (unpinned; present, unused by the CLI) |
|
||||
| html5validator | 0.4.0 (present for the planned HTML linter) |
|
||||
|
||||
Development extras: `pytest>=7.0`, `pytest-cov>=4.0`, `pytest-mock`.
|
||||
Development extras: `pytest>=7.0`, `pytest-cov>=4.0`, `pytest-mock`,
|
||||
`pylint`. `html5validator` is not a dependency until section 7.17
|
||||
is implemented.
|
||||
|
||||
Importable packages live under `src/`: `fiona`, `librarian`,
|
||||
`mdoctor`, `python_ruff`, `customlinter`, `sanity_runner`, `wiki`,
|
||||
`gittool`. `src/llm-wiki/` is package data (the wiki template), not
|
||||
an importable module. Tests live in `src/tests/`.
|
||||
One importable package, `fiona`, lives under `src/fiona/`. Its
|
||||
subpackages are `librarian`, `mdoctor`, `customlinter`,
|
||||
`python_ruff`, `gittool`, `sanity_runner`, and `wiki`. The wiki
|
||||
template is package data at `src/fiona/data/llm_wiki/` and is loaded
|
||||
with `importlib.resources`. It is not an importable module. Tests
|
||||
live in repo-root `tests/` and are not installed. `scripts/` holds
|
||||
`settings_dev.json`, shell helpers, and the launchers
|
||||
`scripts/run_tests.py` and `scripts/run_sanity.py`.
|
||||
|
||||
Console scripts:
|
||||
|
||||
| Script | Entry |
|
||||
| --- | --- |
|
||||
| `fiona-assistant` | `fiona.__main__:main` |
|
||||
| `librarian` | `librarian.librarian:main` |
|
||||
| `mdoctor` | `mdoctor.mdoctor:main` |
|
||||
| `librarian` | `fiona.librarian.librarian:main` |
|
||||
| `mdoctor` | `fiona.mdoctor.mdoctor:main` |
|
||||
|
||||
`python-ruff`, `fmlint`, `json-lint`, and `git` are reached only
|
||||
through `fiona-assistant`. `pyproject.toml` still declares an
|
||||
`html-js-lint` script whose package is absent. Remove that entry
|
||||
until section 7.17 is implemented.
|
||||
through `fiona-assistant`. `html-js-lint` is not installed until
|
||||
section 7.17 is implemented.
|
||||
|
||||
Coverage measures `src/`, omitting tests. The gate percentage is
|
||||
section 5.2.
|
||||
Coverage measures `src/fiona`, omitting tests. The config lives in
|
||||
`pyproject.toml`. The gate percentage is section 5.2.
|
||||
|
||||
Logging: every CLI entry calls `setup_logging()` before work. Level
|
||||
order is `LOG_LEVEL` environment variable, then `fiona.log_level` in
|
||||
@@ -223,7 +228,6 @@ AGENTS.md
|
||||
README.md
|
||||
fiona-settings.json
|
||||
table_of_contents.md
|
||||
__init__.py
|
||||
ingest/README.md
|
||||
personal/README.md
|
||||
raw/README.md
|
||||
@@ -606,10 +610,10 @@ Defaults: output `wiki_graph.html` in the current directory, format
|
||||
|
||||
### 4.13. Repository runners
|
||||
|
||||
`python src/run_tests.py` runs pytest with `--color=no` and a
|
||||
`python scripts/run_tests.py` runs pytest with `--color=no` and a
|
||||
temporary JUnit XML report (`junit_family=xunit1`).
|
||||
|
||||
`python src/run_sanity.py [--non-interactive]` runs, in order:
|
||||
`python scripts/run_sanity.py [--non-interactive]` runs, in order:
|
||||
`pytests`, `markdownlint`, `ruff`, `frontmatter_lint`,
|
||||
`pycustomlint`, `jsonlint`. Same progress display, result table, and
|
||||
verdict shape as wiki sanity, with label `Running Sanity` and an
|
||||
@@ -620,7 +624,7 @@ extra untimed `coverage:` row under pytests. Details are section 7.16.
|
||||
## 5. Settings Schema
|
||||
|
||||
Two files. `fiona-settings.json` ships in the template and marks a
|
||||
wiki root. `src/settings_dev.json` is repository tooling only and is
|
||||
wiki root. `scripts/settings_dev.json` is repository tooling only and is
|
||||
not copied into a wiki.
|
||||
|
||||
### 5.1. fiona-settings.json
|
||||
@@ -1478,10 +1482,9 @@ Implements section 4.5. The sanity check name is `ruff` in
|
||||
|
||||
> Status: Planned
|
||||
|
||||
Remove the `html-js-lint` console script and the `html_js_lint`
|
||||
package entry until this section is built. The intended tool
|
||||
validates HTML with `html5validator` (Java 8+) and JavaScript with
|
||||
`eslint` on PATH.
|
||||
The `html-js-lint` console script is not installed until this
|
||||
section is built. The intended tool validates HTML with
|
||||
`html5validator` (Java 8+) and JavaScript with `eslint` on PATH.
|
||||
|
||||
- *7.17.1.* `NOT_IMPLEMENTED` HTML files (default `.html` and
|
||||
`.htm`) are checked. Findings include path, line, and column.
|
||||
@@ -1580,7 +1583,7 @@ file sink.
|
||||
> Status: Partially Implemented
|
||||
|
||||
`README.md` links to this spec. `src/README.md`,
|
||||
`src/librarian/README.md`, and `src/mdoctor/README.md` exist and
|
||||
`src/fiona/librarian/README.md`, and `src/fiona/mdoctor/README.md` exist and
|
||||
are behind the current CLIs.
|
||||
|
||||
- *7.21.1.* `NOT_IMPLEMENTED` `librarian/README.md` documents `list`
|
||||
@@ -1588,9 +1591,9 @@ are behind the current CLIs.
|
||||
`fix`.
|
||||
- *acceptance*: A new reader can install and run each command
|
||||
from those files alone.
|
||||
- *7.21.2.* `NOT_IMPLEMENTED` `src/README.md` lists `wiki/`,
|
||||
`python_ruff/`, `run_tests.py`, `run_sanity.py`, and
|
||||
`settings_dev.json`.
|
||||
- *7.21.2.* `src/README.md` describes `src/fiona/` (including
|
||||
`wiki/`, `python_ruff/`, and `data/llm_wiki/`), repo-root `tests/`,
|
||||
and `scripts/` (`run_tests.py`, `run_sanity.py`, `settings_dev.json`).
|
||||
- *acceptance*: Those names appear in the structure section.
|
||||
- *7.21.3.* Documentation markdown passes `mdoctor chklint`.
|
||||
- *acceptance*: `README.md` contains a markdown link to `SPEC.md`
|
||||
@@ -1704,18 +1707,20 @@ These notes are not requirements. They point at the current tree.
|
||||
| --- | --- |
|
||||
| CLI dispatch | `src/fiona/__main__.py` |
|
||||
| Logging | `src/fiona/logging_config.py` |
|
||||
| librarian list | `src/librarian/librarian.py` |
|
||||
| TOC | `src/librarian/toc_generator.py` |
|
||||
| mdoctor | `src/mdoctor/mdoctor.py` |
|
||||
| fmlint, mdlinter, pycustomlint, json-lint | `src/customlinter/` |
|
||||
| ruff wrapper | `src/python_ruff/python_ruff.py` |
|
||||
| wiki init | `src/wiki/wiki.py` |
|
||||
| wiki update | `src/wiki/update_manager.py` |
|
||||
| wiki sanity | `src/wiki/sanity_manager.py` |
|
||||
| wiki graph | `src/wiki/graph_generator.py`, `src/wiki/templates/graph_template.html` |
|
||||
| git | `src/gittool/git_tool.py` |
|
||||
| sanity engine | `src/sanity_runner/sanity_runner.py` |
|
||||
| runners | `src/run_tests.py`, `src/run_sanity.py` |
|
||||
| template path | `src/fiona/paths.py` |
|
||||
| librarian list | `src/fiona/librarian/librarian.py` |
|
||||
| TOC | `src/fiona/librarian/toc_generator.py` |
|
||||
| mdoctor | `src/fiona/mdoctor/mdoctor.py` |
|
||||
| fmlint, mdlinter, pycustomlint, json-lint | `src/fiona/customlinter/` |
|
||||
| ruff wrapper | `src/fiona/python_ruff/python_ruff.py` |
|
||||
| wiki init | `src/fiona/wiki/wiki.py` |
|
||||
| wiki update | `src/fiona/wiki/update_manager.py` |
|
||||
| wiki sanity | `src/fiona/wiki/sanity_manager.py` |
|
||||
| wiki graph | `src/fiona/wiki/graph_generator.py`, `src/fiona/wiki/templates/graph_template.html` |
|
||||
| git | `src/fiona/gittool/git_tool.py` |
|
||||
| sanity engine | `src/fiona/sanity_runner/sanity_runner.py` |
|
||||
| runners | `src/fiona/run_tests.py`, `src/fiona/run_sanity.py` |
|
||||
| launchers | `scripts/run_tests.py`, `scripts/run_sanity.py` |
|
||||
|
||||
Known defects to avoid copying blindly:
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ CLEAN_ENVIRONMENT=false # Flag to delete and recreate environment
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # scripts root directory
|
||||
|
||||
# Source utilities (needed for echo_error, echo_status, etc.)
|
||||
source "$SCRIPT_DIR/src/utils.sh"
|
||||
source "$SCRIPT_DIR/scripts/utils.sh"
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -387,18 +387,18 @@ upgrade_pip() {
|
||||
|
||||
install_dev_packages() {
|
||||
echo_status "Installing local Python packages in development mode..."
|
||||
local install_script="$SCRIPT_DIR/src/install_packages.sh"
|
||||
local install_script="$SCRIPT_DIR/scripts/install_packages.sh"
|
||||
|
||||
if [ -f "$install_script" ]; then
|
||||
# Use source to run in current shell context, preserving environment variables
|
||||
(cd "$SCRIPT_DIR/src" && . "$install_script") || {
|
||||
(cd "$SCRIPT_DIR" && . "$install_script") || {
|
||||
echo_error "Dev packages not installed!"
|
||||
return 1
|
||||
}
|
||||
else
|
||||
echo_status "Install script not found at $install_script, attempting direct install..."
|
||||
# Fallback: install in editable mode from src directory
|
||||
(cd "$SCRIPT_DIR/src" && pip install -e . --break-system-packages) || {
|
||||
# Fallback: install in editable mode from the repository root
|
||||
(cd "$SCRIPT_DIR" && pip install -e . --break-system-packages) || {
|
||||
echo_error "Failed to install package in development mode"
|
||||
return 1
|
||||
}
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ Write-FionaStatus "Python: $pythonVersionText ($pythonWhere)"
|
||||
Write-FionaStatus "Pip: $pipVersionText"
|
||||
Write-FionaStatus ""
|
||||
Write-FionaStatus "To verify installation, try:"
|
||||
Write-FionaStatus " python src/run_tests.py"
|
||||
Write-FionaStatus " python scripts/run_tests.py"
|
||||
Write-FionaStatus " fiona-assistant --help"
|
||||
Write-FionaStatus ""
|
||||
Write-FionaStatus "Happy coding!"
|
||||
|
||||
-612
@@ -1,612 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<coverage version="7.16.1" timestamp="1790528640380" lines-valid="578" lines-covered="454" line-rate="0.7855" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
|
||||
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.16.1 -->
|
||||
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
|
||||
<sources>
|
||||
<source>/home/user/repositories/fiona-assistant/src/customlinter</source>
|
||||
</sources>
|
||||
<packages>
|
||||
<package name="." line-rate="0.7855" branch-rate="0" complexity="0">
|
||||
<classes>
|
||||
<class name="__init__.py" filename="__init__.py" complexity="0" line-rate="1" branch-rate="0">
|
||||
<methods/>
|
||||
<lines>
|
||||
<line number="17" hits="1"/>
|
||||
<line number="26" hits="1"/>
|
||||
<line number="27" hits="1"/>
|
||||
<line number="29" hits="1"/>
|
||||
</lines>
|
||||
</class>
|
||||
<class name="base.py" filename="base.py" complexity="0" line-rate="0.6962" branch-rate="0">
|
||||
<methods/>
|
||||
<lines>
|
||||
<line number="8" hits="1"/>
|
||||
<line number="10" hits="1"/>
|
||||
<line number="11" hits="1"/>
|
||||
<line number="12" hits="1"/>
|
||||
<line number="13" hits="1"/>
|
||||
<line number="14" hits="1"/>
|
||||
<line number="15" hits="1"/>
|
||||
<line number="16" hits="1"/>
|
||||
<line number="18" hits="1"/>
|
||||
<line number="25" hits="1"/>
|
||||
<line number="28" hits="1"/>
|
||||
<line number="33" hits="1"/>
|
||||
<line number="49" hits="1"/>
|
||||
<line number="52" hits="1"/>
|
||||
<line number="65" hits="1"/>
|
||||
<line number="66" hits="1"/>
|
||||
<line number="67" hits="1"/>
|
||||
<line number="68" hits="1"/>
|
||||
<line number="72" hits="1"/>
|
||||
<line number="79" hits="1"/>
|
||||
<line number="90" hits="1"/>
|
||||
<line number="97" hits="1"/>
|
||||
<line number="118" hits="1"/>
|
||||
<line number="119" hits="1"/>
|
||||
<line number="120" hits="1"/>
|
||||
<line number="121" hits="1"/>
|
||||
<line number="122" hits="1"/>
|
||||
<line number="123" hits="1"/>
|
||||
<line number="124" hits="1"/>
|
||||
<line number="126" hits="1"/>
|
||||
<line number="128" hits="1"/>
|
||||
<line number="138" hits="1"/>
|
||||
<line number="140" hits="1"/>
|
||||
<line number="147" hits="1"/>
|
||||
<line number="164" hits="1"/>
|
||||
<line number="167" hits="1"/>
|
||||
<line number="170" hits="1"/>
|
||||
<line number="172" hits="1"/>
|
||||
<line number="178" hits="1"/>
|
||||
<line number="179" hits="1"/>
|
||||
<line number="181" hits="1"/>
|
||||
<line number="183" hits="1"/>
|
||||
<line number="184" hits="1"/>
|
||||
<line number="186" hits="1"/>
|
||||
<line number="187" hits="1"/>
|
||||
<line number="188" hits="1"/>
|
||||
<line number="190" hits="1"/>
|
||||
<line number="191" hits="1"/>
|
||||
<line number="192" hits="1"/>
|
||||
<line number="193" hits="1"/>
|
||||
<line number="194" hits="0"/>
|
||||
<line number="195" hits="1"/>
|
||||
<line number="196" hits="1"/>
|
||||
<line number="197" hits="1"/>
|
||||
<line number="210" hits="1"/>
|
||||
<line number="219" hits="0"/>
|
||||
<line number="220" hits="0"/>
|
||||
<line number="222" hits="0"/>
|
||||
<line number="223" hits="0"/>
|
||||
<line number="226" hits="0"/>
|
||||
<line number="229" hits="0"/>
|
||||
<line number="230" hits="0"/>
|
||||
<line number="231" hits="0"/>
|
||||
<line number="233" hits="0"/>
|
||||
<line number="235" hits="1"/>
|
||||
<line number="244" hits="1"/>
|
||||
<line number="247" hits="1"/>
|
||||
<line number="248" hits="1"/>
|
||||
<line number="250" hits="1"/>
|
||||
<line number="251" hits="1"/>
|
||||
<line number="252" hits="1"/>
|
||||
<line number="253" hits="1"/>
|
||||
<line number="254" hits="1"/>
|
||||
<line number="255" hits="1"/>
|
||||
<line number="256" hits="1"/>
|
||||
<line number="257" hits="0"/>
|
||||
<line number="258" hits="0"/>
|
||||
<line number="261" hits="1"/>
|
||||
<line number="262" hits="1"/>
|
||||
<line number="265" hits="1"/>
|
||||
<line number="266" hits="1"/>
|
||||
<line number="267" hits="1"/>
|
||||
<line number="270" hits="1"/>
|
||||
<line number="272" hits="1"/>
|
||||
<line number="273" hits="1"/>
|
||||
<line number="276" hits="1"/>
|
||||
<line number="278" hits="1"/>
|
||||
<line number="280" hits="1"/>
|
||||
<line number="290" hits="1"/>
|
||||
<line number="291" hits="1"/>
|
||||
<line number="292" hits="1"/>
|
||||
<line number="294" hits="1"/>
|
||||
<line number="295" hits="1"/>
|
||||
<line number="296" hits="1"/>
|
||||
<line number="298" hits="1"/>
|
||||
<line number="308" hits="1"/>
|
||||
<line number="309" hits="1"/>
|
||||
<line number="312" hits="1"/>
|
||||
<line number="313" hits="1"/>
|
||||
<line number="316" hits="1"/>
|
||||
<line number="317" hits="1"/>
|
||||
<line number="318" hits="1"/>
|
||||
<line number="319" hits="1"/>
|
||||
<line number="320" hits="1"/>
|
||||
<line number="321" hits="1"/>
|
||||
<line number="323" hits="1"/>
|
||||
<line number="325" hits="1"/>
|
||||
<line number="335" hits="1"/>
|
||||
<line number="336" hits="1"/>
|
||||
<line number="337" hits="1"/>
|
||||
<line number="338" hits="1"/>
|
||||
<line number="339" hits="1"/>
|
||||
<line number="340" hits="0"/>
|
||||
<line number="342" hits="0"/>
|
||||
<line number="343" hits="0"/>
|
||||
<line number="345" hits="1"/>
|
||||
<line number="354" hits="1"/>
|
||||
<line number="355" hits="1"/>
|
||||
<line number="357" hits="1"/>
|
||||
<line number="358" hits="1"/>
|
||||
<line number="359" hits="1"/>
|
||||
<line number="361" hits="1"/>
|
||||
<line number="363" hits="1"/>
|
||||
<line number="372" hits="1"/>
|
||||
<line number="374" hits="1"/>
|
||||
<line number="390" hits="0"/>
|
||||
<line number="391" hits="0"/>
|
||||
<line number="392" hits="0"/>
|
||||
<line number="393" hits="0"/>
|
||||
<line number="396" hits="0"/>
|
||||
<line number="397" hits="0"/>
|
||||
<line number="398" hits="0"/>
|
||||
<line number="399" hits="0"/>
|
||||
<line number="400" hits="0"/>
|
||||
<line number="406" hits="0"/>
|
||||
<line number="407" hits="0"/>
|
||||
<line number="408" hits="0"/>
|
||||
<line number="409" hits="0"/>
|
||||
<line number="412" hits="0"/>
|
||||
<line number="415" hits="0"/>
|
||||
<line number="416" hits="0"/>
|
||||
<line number="417" hits="0"/>
|
||||
<line number="418" hits="0"/>
|
||||
<line number="419" hits="0"/>
|
||||
<line number="420" hits="0"/>
|
||||
<line number="421" hits="0"/>
|
||||
<line number="423" hits="0"/>
|
||||
<line number="424" hits="0"/>
|
||||
<line number="425" hits="0"/>
|
||||
<line number="426" hits="0"/>
|
||||
<line number="427" hits="0"/>
|
||||
<line number="429" hits="0"/>
|
||||
<line number="430" hits="0"/>
|
||||
<line number="433" hits="0"/>
|
||||
<line number="434" hits="0"/>
|
||||
<line number="435" hits="0"/>
|
||||
<line number="436" hits="0"/>
|
||||
<line number="438" hits="0"/>
|
||||
</lines>
|
||||
</class>
|
||||
<class name="fmlint.py" filename="fmlint.py" complexity="0" line-rate="0.766" branch-rate="0">
|
||||
<methods/>
|
||||
<lines>
|
||||
<line number="19" hits="1"/>
|
||||
<line number="21" hits="1"/>
|
||||
<line number="22" hits="1"/>
|
||||
<line number="23" hits="1"/>
|
||||
<line number="24" hits="1"/>
|
||||
<line number="25" hits="1"/>
|
||||
<line number="27" hits="1"/>
|
||||
<line number="29" hits="1"/>
|
||||
<line number="37" hits="1"/>
|
||||
<line number="40" hits="1"/>
|
||||
<line number="43" hits="1"/>
|
||||
<line number="46" hits="1"/>
|
||||
<line number="53" hits="1"/>
|
||||
<line number="103" hits="1"/>
|
||||
<line number="115" hits="0"/>
|
||||
<line number="116" hits="0"/>
|
||||
<line number="117" hits="0"/>
|
||||
<line number="118" hits="0"/>
|
||||
<line number="119" hits="0"/>
|
||||
<line number="120" hits="0"/>
|
||||
<line number="121" hits="0"/>
|
||||
<line number="122" hits="0"/>
|
||||
<line number="125" hits="1"/>
|
||||
<line number="134" hits="1"/>
|
||||
<line number="137" hits="1"/>
|
||||
<line number="148" hits="1"/>
|
||||
<line number="151" hits="1"/>
|
||||
<line number="152" hits="1"/>
|
||||
<line number="155" hits="1"/>
|
||||
<line number="156" hits="1"/>
|
||||
<line number="158" hits="1"/>
|
||||
<line number="161" hits="1"/>
|
||||
<line number="180" hits="1"/>
|
||||
<line number="181" hits="1"/>
|
||||
<line number="183" hits="1"/>
|
||||
<line number="184" hits="1"/>
|
||||
<line number="186" hits="1"/>
|
||||
<line number="187" hits="1"/>
|
||||
<line number="190" hits="1"/>
|
||||
<line number="191" hits="1"/>
|
||||
<line number="192" hits="1"/>
|
||||
<line number="193" hits="1"/>
|
||||
<line number="196" hits="1"/>
|
||||
<line number="197" hits="1"/>
|
||||
<line number="198" hits="1"/>
|
||||
<line number="199" hits="1"/>
|
||||
<line number="202" hits="1"/>
|
||||
<line number="203" hits="1"/>
|
||||
<line number="210" hits="1"/>
|
||||
<line number="212" hits="1"/>
|
||||
<line number="213" hits="1"/>
|
||||
<line number="219" hits="1"/>
|
||||
<line number="226" hits="1"/>
|
||||
<line number="238" hits="1"/>
|
||||
<line number="239" hits="1"/>
|
||||
<line number="240" hits="1"/>
|
||||
<line number="242" hits="1"/>
|
||||
<line number="258" hits="1"/>
|
||||
<line number="261" hits="1"/>
|
||||
<line number="262" hits="1"/>
|
||||
<line number="263" hits="1"/>
|
||||
<line number="264" hits="1"/>
|
||||
<line number="265" hits="1"/>
|
||||
<line number="266" hits="1"/>
|
||||
<line number="267" hits="1"/>
|
||||
<line number="270" hits="1"/>
|
||||
<line number="272" hits="1"/>
|
||||
<line number="275" hits="1"/>
|
||||
<line number="278" hits="1"/>
|
||||
<line number="281" hits="1"/>
|
||||
<line number="282" hits="1"/>
|
||||
<line number="283" hits="1"/>
|
||||
<line number="286" hits="1"/>
|
||||
<line number="287" hits="1"/>
|
||||
<line number="290" hits="1"/>
|
||||
<line number="291" hits="1"/>
|
||||
<line number="293" hits="1"/>
|
||||
<line number="302" hits="1"/>
|
||||
<line number="304" hits="1"/>
|
||||
<line number="306" hits="1"/>
|
||||
<line number="307" hits="0"/>
|
||||
<line number="310" hits="1"/>
|
||||
<line number="311" hits="0"/>
|
||||
<line number="314" hits="1"/>
|
||||
<line number="315" hits="1"/>
|
||||
<line number="316" hits="1"/>
|
||||
<line number="318" hits="0"/>
|
||||
<line number="319" hits="0"/>
|
||||
<line number="320" hits="0"/>
|
||||
<line number="321" hits="0"/>
|
||||
<line number="322" hits="0"/>
|
||||
<line number="323" hits="0"/>
|
||||
<line number="325" hits="0"/>
|
||||
<line number="326" hits="0"/>
|
||||
<line number="327" hits="1"/>
|
||||
<line number="328" hits="0"/>
|
||||
<line number="331" hits="1"/>
|
||||
<line number="332" hits="1"/>
|
||||
<line number="333" hits="0"/>
|
||||
<line number="335" hits="0"/>
|
||||
<line number="343" hits="0"/>
|
||||
<line number="344" hits="0"/>
|
||||
<line number="347" hits="1"/>
|
||||
<line number="348" hits="1"/>
|
||||
<line number="349" hits="1"/>
|
||||
<line number="350" hits="1"/>
|
||||
<line number="358" hits="1"/>
|
||||
<line number="359" hits="1"/>
|
||||
<line number="362" hits="1"/>
|
||||
<line number="363" hits="1"/>
|
||||
<line number="371" hits="1"/>
|
||||
<line number="372" hits="1"/>
|
||||
<line number="375" hits="1"/>
|
||||
<line number="378" hits="1"/>
|
||||
<line number="384" hits="1"/>
|
||||
<line number="385" hits="1"/>
|
||||
<line number="386" hits="1"/>
|
||||
<line number="394" hits="1"/>
|
||||
<line number="397" hits="1"/>
|
||||
<line number="399" hits="1"/>
|
||||
<line number="400" hits="1"/>
|
||||
<line number="408" hits="1"/>
|
||||
<line number="410" hits="1"/>
|
||||
<line number="411" hits="1"/>
|
||||
<line number="413" hits="1"/>
|
||||
<line number="414" hits="1"/>
|
||||
<line number="416" hits="1"/>
|
||||
<line number="417" hits="1"/>
|
||||
<line number="418" hits="1"/>
|
||||
<line number="426" hits="1"/>
|
||||
<line number="427" hits="1"/>
|
||||
<line number="428" hits="1"/>
|
||||
<line number="436" hits="1"/>
|
||||
<line number="439" hits="1"/>
|
||||
<line number="444" hits="1"/>
|
||||
<line number="446" hits="1"/>
|
||||
<line number="473" hits="1"/>
|
||||
<line number="476" hits="1"/>
|
||||
<line number="487" hits="1"/>
|
||||
<line number="489" hits="1"/>
|
||||
<line number="491" hits="1"/>
|
||||
<line number="492" hits="1"/>
|
||||
<line number="493" hits="1"/>
|
||||
<line number="495" hits="0"/>
|
||||
<line number="496" hits="0"/>
|
||||
<line number="497" hits="0"/>
|
||||
<line number="498" hits="0"/>
|
||||
<line number="499" hits="0"/>
|
||||
<line number="500" hits="0"/>
|
||||
<line number="502" hits="0"/>
|
||||
<line number="503" hits="0"/>
|
||||
<line number="504" hits="1"/>
|
||||
<line number="505" hits="0"/>
|
||||
<line number="508" hits="1"/>
|
||||
<line number="511" hits="1"/>
|
||||
<line number="512" hits="1"/>
|
||||
<line number="513" hits="1"/>
|
||||
<line number="514" hits="1"/>
|
||||
<line number="516" hits="1"/>
|
||||
<line number="517" hits="1"/>
|
||||
<line number="518" hits="1"/>
|
||||
<line number="523" hits="1"/>
|
||||
<line number="524" hits="1"/>
|
||||
<line number="526" hits="1"/>
|
||||
<line number="527" hits="1"/>
|
||||
<line number="528" hits="1"/>
|
||||
<line number="530" hits="1"/>
|
||||
<line number="532" hits="1"/>
|
||||
<line number="548" hits="1"/>
|
||||
<line number="549" hits="1"/>
|
||||
<line number="550" hits="1"/>
|
||||
<line number="551" hits="1"/>
|
||||
<line number="552" hits="1"/>
|
||||
<line number="556" hits="1"/>
|
||||
<line number="558" hits="1"/>
|
||||
<line number="570" hits="1"/>
|
||||
<line number="572" hits="1"/>
|
||||
<line number="573" hits="1"/>
|
||||
<line number="575" hits="1"/>
|
||||
<line number="578" hits="1"/>
|
||||
<line number="579" hits="1"/>
|
||||
<line number="580" hits="1"/>
|
||||
<line number="583" hits="1"/>
|
||||
<line number="584" hits="1"/>
|
||||
<line number="587" hits="1"/>
|
||||
<line number="588" hits="0"/>
|
||||
<line number="591" hits="1"/>
|
||||
<line number="592" hits="0"/>
|
||||
<line number="594" hits="1"/>
|
||||
<line number="597" hits="1"/>
|
||||
<line number="598" hits="1"/>
|
||||
<line number="599" hits="1"/>
|
||||
<line number="600" hits="1"/>
|
||||
<line number="601" hits="1"/>
|
||||
<line number="602" hits="1"/>
|
||||
<line number="603" hits="1"/>
|
||||
<line number="605" hits="1"/>
|
||||
<line number="607" hits="1"/>
|
||||
<line number="617" hits="1"/>
|
||||
<line number="618" hits="1"/>
|
||||
<line number="619" hits="1"/>
|
||||
<line number="620" hits="1"/>
|
||||
<line number="621" hits="1"/>
|
||||
<line number="622" hits="0"/>
|
||||
<line number="623" hits="1"/>
|
||||
<line number="624" hits="1"/>
|
||||
<line number="625" hits="1"/>
|
||||
<line number="627" hits="1"/>
|
||||
<line number="637" hits="1"/>
|
||||
<line number="638" hits="1"/>
|
||||
<line number="639" hits="1"/>
|
||||
<line number="641" hits="1"/>
|
||||
<line number="642" hits="1"/>
|
||||
<line number="643" hits="1"/>
|
||||
<line number="645" hits="1"/>
|
||||
<line number="646" hits="1"/>
|
||||
<line number="647" hits="1"/>
|
||||
<line number="648" hits="1"/>
|
||||
<line number="649" hits="1"/>
|
||||
<line number="651" hits="1"/>
|
||||
<line number="652" hits="1"/>
|
||||
<line number="653" hits="0"/>
|
||||
<line number="655" hits="1"/>
|
||||
<line number="656" hits="1"/>
|
||||
<line number="658" hits="1"/>
|
||||
<line number="660" hits="1"/>
|
||||
<line number="671" hits="1"/>
|
||||
<line number="673" hits="1"/>
|
||||
<line number="674" hits="1"/>
|
||||
<line number="675" hits="1"/>
|
||||
<line number="676" hits="1"/>
|
||||
<line number="679" hits="1"/>
|
||||
<line number="680" hits="1"/>
|
||||
<line number="681" hits="1"/>
|
||||
<line number="682" hits="1"/>
|
||||
<line number="683" hits="1"/>
|
||||
<line number="684" hits="1"/>
|
||||
<line number="685" hits="1"/>
|
||||
<line number="688" hits="1"/>
|
||||
<line number="689" hits="1"/>
|
||||
<line number="690" hits="1"/>
|
||||
<line number="691" hits="1"/>
|
||||
<line number="692" hits="1"/>
|
||||
<line number="693" hits="1"/>
|
||||
<line number="695" hits="1"/>
|
||||
<line number="696" hits="1"/>
|
||||
<line number="699" hits="1"/>
|
||||
<line number="700" hits="1"/>
|
||||
<line number="701" hits="1"/>
|
||||
<line number="702" hits="1"/>
|
||||
<line number="703" hits="1"/>
|
||||
<line number="705" hits="1"/>
|
||||
<line number="707" hits="1"/>
|
||||
<line number="725" hits="0"/>
|
||||
<line number="726" hits="0"/>
|
||||
<line number="727" hits="0"/>
|
||||
<line number="728" hits="0"/>
|
||||
<line number="731" hits="0"/>
|
||||
<line number="732" hits="0"/>
|
||||
<line number="733" hits="0"/>
|
||||
<line number="734" hits="0"/>
|
||||
<line number="735" hits="0"/>
|
||||
<line number="741" hits="0"/>
|
||||
<line number="742" hits="0"/>
|
||||
<line number="743" hits="0"/>
|
||||
<line number="744" hits="0"/>
|
||||
<line number="745" hits="0"/>
|
||||
<line number="746" hits="0"/>
|
||||
<line number="747" hits="0"/>
|
||||
<line number="750" hits="0"/>
|
||||
<line number="751" hits="0"/>
|
||||
<line number="752" hits="0"/>
|
||||
<line number="753" hits="0"/>
|
||||
<line number="754" hits="0"/>
|
||||
<line number="755" hits="0"/>
|
||||
<line number="758" hits="0"/>
|
||||
<line number="759" hits="0"/>
|
||||
<line number="760" hits="0"/>
|
||||
<line number="761" hits="0"/>
|
||||
<line number="762" hits="0"/>
|
||||
<line number="763" hits="0"/>
|
||||
<line number="765" hits="0"/>
|
||||
<line number="766" hits="0"/>
|
||||
<line number="769" hits="0"/>
|
||||
<line number="770" hits="0"/>
|
||||
<line number="771" hits="0"/>
|
||||
<line number="772" hits="0"/>
|
||||
<line number="774" hits="0"/>
|
||||
<line number="781" hits="1"/>
|
||||
<line number="783" hits="1"/>
|
||||
<line number="784" hits="1"/>
|
||||
<line number="786" hits="1"/>
|
||||
<line number="788" hits="1"/>
|
||||
<line number="790" hits="1"/>
|
||||
<line number="793" hits="1"/>
|
||||
<line number="796" hits="1"/>
|
||||
<line number="800" hits="1"/>
|
||||
<line number="807" hits="1"/>
|
||||
<line number="809" hits="1"/>
|
||||
<line number="811" hits="1"/>
|
||||
<line number="812" hits="1"/>
|
||||
<line number="814" hits="1"/>
|
||||
<line number="815" hits="1"/>
|
||||
<line number="816" hits="1"/>
|
||||
<line number="818" hits="1"/>
|
||||
<line number="819" hits="1"/>
|
||||
<line number="820" hits="1"/>
|
||||
<line number="822" hits="1"/>
|
||||
<line number="823" hits="1"/>
|
||||
<line number="824" hits="1"/>
|
||||
<line number="826" hits="0"/>
|
||||
<line number="827" hits="0"/>
|
||||
</lines>
|
||||
</class>
|
||||
<class name="pycustomlint.py" filename="pycustomlint.py" complexity="0" line-rate="0.9712" branch-rate="0">
|
||||
<methods/>
|
||||
<lines>
|
||||
<line number="19" hits="1"/>
|
||||
<line number="21" hits="1"/>
|
||||
<line number="22" hits="1"/>
|
||||
<line number="23" hits="1"/>
|
||||
<line number="24" hits="1"/>
|
||||
<line number="25" hits="1"/>
|
||||
<line number="27" hits="1"/>
|
||||
<line number="29" hits="1"/>
|
||||
<line number="32" hits="1"/>
|
||||
<line number="40" hits="1"/>
|
||||
<line number="60" hits="1"/>
|
||||
<line number="63" hits="1"/>
|
||||
<line number="69" hits="1"/>
|
||||
<line number="70" hits="1"/>
|
||||
<line number="72" hits="1"/>
|
||||
<line number="74" hits="1"/>
|
||||
<line number="75" hits="1"/>
|
||||
<line number="76" hits="1"/>
|
||||
<line number="78" hits="1"/>
|
||||
<line number="80" hits="1"/>
|
||||
<line number="81" hits="1"/>
|
||||
<line number="82" hits="1"/>
|
||||
<line number="84" hits="1"/>
|
||||
<line number="87" hits="1"/>
|
||||
<line number="88" hits="1"/>
|
||||
<line number="89" hits="1"/>
|
||||
<line number="90" hits="1"/>
|
||||
<line number="91" hits="1"/>
|
||||
<line number="92" hits="1"/>
|
||||
<line number="93" hits="1"/>
|
||||
<line number="94" hits="1"/>
|
||||
<line number="95" hits="1"/>
|
||||
<line number="97" hits="1"/>
|
||||
<line number="105" hits="1"/>
|
||||
<line number="107" hits="1"/>
|
||||
<line number="109" hits="1"/>
|
||||
<line number="116" hits="1"/>
|
||||
<line number="122" hits="1"/>
|
||||
<line number="123" hits="1"/>
|
||||
<line number="124" hits="1"/>
|
||||
<line number="126" hits="1"/>
|
||||
<line number="135" hits="1"/>
|
||||
<line number="137" hits="1"/>
|
||||
<line number="139" hits="1"/>
|
||||
<line number="140" hits="1"/>
|
||||
<line number="143" hits="1"/>
|
||||
<line number="144" hits="0"/>
|
||||
<line number="147" hits="1"/>
|
||||
<line number="148" hits="1"/>
|
||||
<line number="151" hits="1"/>
|
||||
<line number="152" hits="1"/>
|
||||
<line number="153" hits="1"/>
|
||||
<line number="155" hits="1"/>
|
||||
<line number="157" hits="1"/>
|
||||
<line number="158" hits="1"/>
|
||||
<line number="159" hits="1"/>
|
||||
<line number="161" hits="1"/>
|
||||
<line number="163" hits="1"/>
|
||||
<line number="177" hits="1"/>
|
||||
<line number="178" hits="1"/>
|
||||
<line number="179" hits="1"/>
|
||||
<line number="181" hits="1"/>
|
||||
<line number="182" hits="1"/>
|
||||
<line number="185" hits="1"/>
|
||||
<line number="188" hits="1"/>
|
||||
<line number="189" hits="1"/>
|
||||
<line number="190" hits="1"/>
|
||||
<line number="192" hits="1"/>
|
||||
<line number="194" hits="1"/>
|
||||
<line number="196" hits="1"/>
|
||||
<line number="203" hits="1"/>
|
||||
<line number="205" hits="1"/>
|
||||
<line number="207" hits="1"/>
|
||||
<line number="209" hits="1"/>
|
||||
<line number="210" hits="1"/>
|
||||
<line number="212" hits="1"/>
|
||||
<line number="215" hits="1"/>
|
||||
<line number="218" hits="1"/>
|
||||
<line number="222" hits="1"/>
|
||||
<line number="228" hits="1"/>
|
||||
<line number="234" hits="1"/>
|
||||
<line number="236" hits="1"/>
|
||||
<line number="238" hits="1"/>
|
||||
<line number="239" hits="1"/>
|
||||
<line number="240" hits="1"/>
|
||||
<line number="242" hits="1"/>
|
||||
<line number="243" hits="1"/>
|
||||
<line number="245" hits="1"/>
|
||||
<line number="247" hits="1"/>
|
||||
<line number="248" hits="1"/>
|
||||
<line number="249" hits="1"/>
|
||||
<line number="252" hits="1"/>
|
||||
<line number="253" hits="1"/>
|
||||
<line number="255" hits="1"/>
|
||||
<line number="257" hits="1"/>
|
||||
<line number="258" hits="1"/>
|
||||
<line number="260" hits="1"/>
|
||||
<line number="262" hits="1"/>
|
||||
<line number="263" hits="1"/>
|
||||
<line number="264" hits="1"/>
|
||||
<line number="266" hits="1"/>
|
||||
<line number="267" hits="1"/>
|
||||
<line number="269" hits="0"/>
|
||||
<line number="270" hits="0"/>
|
||||
</lines>
|
||||
</class>
|
||||
</classes>
|
||||
</package>
|
||||
</packages>
|
||||
</coverage>
|
||||
+23
-20
@@ -1,29 +1,29 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=42"]
|
||||
requires = ["setuptools>=61"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "fiona-assistant"
|
||||
version = "0.40.5"
|
||||
version = "0.41.0"
|
||||
description = "Tools for managing the LLM wiki."
|
||||
authors = [{name = "nvaldeziii"}]
|
||||
readme = "README.md"
|
||||
license = "GPL-3.0-only"
|
||||
requires-python = ">=3.8"
|
||||
requires-python = ">=3.11"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
|
||||
# Core dependencies (required for runtime)
|
||||
# Note: html5validator requires Java 8+ to be installed on the system
|
||||
dependencies = [
|
||||
"pymarkdownlnt>=0.9.0",
|
||||
"ruff>=0.16.8",
|
||||
"pyyaml>=6.0.3",
|
||||
"pylint",
|
||||
"GitPython>=3.1.0",
|
||||
"html5validator>=0.4.0",
|
||||
]
|
||||
|
||||
# Optional dependencies groups
|
||||
@@ -32,6 +32,7 @@ dev = [
|
||||
"pytest>=7.0.0",
|
||||
"pytest-cov>=4.0.0",
|
||||
"pytest-mock",
|
||||
"pylint",
|
||||
"build",
|
||||
"twine",
|
||||
]
|
||||
@@ -41,23 +42,21 @@ include-package-data = true
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
# llm-wiki is a hyphenated, non-importable data-only "package" that ships
|
||||
# template files (wiki/, ingest/, AGENTS.md, etc.) as package data.
|
||||
# The hyphen makes it unimportable as a Python module (import llm-wiki
|
||||
# is a SyntaxError), but setuptools allows it as a distribution package name.
|
||||
# The __init__.py exists only to satisfy setuptools' package detection.
|
||||
include = ["fiona", "librarian", "mdoctor", "python_ruff", "customlinter", "sanity_runner", "llm-wiki", "wiki", "gittool", "html_js_lint"]
|
||||
include = ["fiona*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
# Include all files under llm-wiki/ as package data (not Python code)
|
||||
"llm-wiki" = ["*", "**/*"]
|
||||
fiona = [
|
||||
"data/llm_wiki/**/*",
|
||||
"wiki/templates/*",
|
||||
]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["src/tests"]
|
||||
testpaths = ["tests"]
|
||||
pythonpath = ["src"]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["src"]
|
||||
omit = ["src/tests/*", "*/tests/*", "*/test_*.py"]
|
||||
source = ["src/fiona"]
|
||||
omit = ["*/tests/*", "*/test_*.py"]
|
||||
|
||||
[tool.coverage.report]
|
||||
exclude_lines = [
|
||||
@@ -73,6 +72,10 @@ exclude_lines = [
|
||||
# Define console scripts entry points
|
||||
[project.scripts]
|
||||
fiona-assistant = "fiona.__main__:main"
|
||||
librarian = "librarian.librarian:main"
|
||||
mdoctor = "mdoctor.mdoctor:main"
|
||||
html-js-lint = "html_js_lint.html_js_lint:main"
|
||||
librarian = "fiona.librarian.librarian:main"
|
||||
mdoctor = "fiona.mdoctor.mdoctor:main"
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py311"
|
||||
line-length = 100
|
||||
src = ["src"]
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Repo-root launcher for the sanity runner.
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - implementation lives in fiona.run_sanity.
|
||||
"""
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
_SRC = pathlib.Path(__file__).resolve().parent.parent / "src"
|
||||
if str(_SRC) not in sys.path:
|
||||
sys.path.insert(0, str(_SRC))
|
||||
|
||||
import fiona.run_sanity as runner # noqa: E402
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(runner.main())
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Repo-root launcher for the test runner.
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - implementation lives in fiona.run_tests.
|
||||
"""
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
_SRC = pathlib.Path(__file__).resolve().parent.parent / "src"
|
||||
if str(_SRC) not in sys.path:
|
||||
sys.path.insert(0, str(_SRC))
|
||||
|
||||
import fiona.run_tests as runner # noqa: E402
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(runner.main())
|
||||
+34
-15
@@ -7,7 +7,7 @@ A collection of tools for managing the LLM wiki and related operations.
|
||||
The Fiona Assistant project provides command-line tools for:
|
||||
|
||||
- **Librarian**: Managing LLM wiki content and operations
|
||||
- **MDoctor**: [Description to be added]
|
||||
- **MDoctor**: Markdown diagnosis (lint, list, and fix)
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -57,7 +57,7 @@ pip install -e ".[dev]"
|
||||
|
||||
### Librarian
|
||||
|
||||
See [librarian/README.md](./librarian/README.md) for detailed usage.
|
||||
See [librarian/README.md](./fiona/librarian/README.md) for detailed usage.
|
||||
|
||||
```bash
|
||||
librarian --help
|
||||
@@ -65,7 +65,7 @@ librarian --help
|
||||
|
||||
### MDoctor
|
||||
|
||||
See [mdoctor/README.md](./mdoctor/README.md) for detailed usage.
|
||||
See [mdoctor/README.md](./fiona/mdoctor/README.md) for detailed usage.
|
||||
|
||||
```bash
|
||||
mdoctor --help
|
||||
@@ -74,22 +74,38 @@ mdoctor --help
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
src/
|
||||
├── fiona/ # Main package
|
||||
├── librarian/ # Wiki content management tool
|
||||
├── mdoctor/ # [Tool description]
|
||||
├── tests/ # Unit tests
|
||||
└── README.md # This file
|
||||
src/fiona/
|
||||
├── __main__.py # CLI entry point
|
||||
├── librarian/ # Wiki content management
|
||||
├── mdoctor/ # Markdown diagnosis
|
||||
├── customlinter/ # Frontmatter, markdown, Python, and JSON linters
|
||||
├── python_ruff/ # Ruff wrapper
|
||||
├── gittool/ # Git operations
|
||||
├── sanity_runner/ # Shared sanity engine
|
||||
├── wiki/ # Wiki init, update, sanity, and graph
|
||||
├── data/llm_wiki/ # Packaged wiki template
|
||||
├── run_tests.py # Test runner
|
||||
└── run_sanity.py # Sanity runner
|
||||
tests/ # Unit tests (repository root, not installed)
|
||||
scripts/
|
||||
├── run_tests.py
|
||||
├── run_sanity.py
|
||||
├── settings_dev.json
|
||||
├── utils.sh
|
||||
└── install_packages.sh
|
||||
```
|
||||
|
||||
## Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest
|
||||
python scripts/run_tests.py
|
||||
|
||||
# Or use pytest directly
|
||||
python -m pytest
|
||||
|
||||
# Run with coverage
|
||||
pytest --cov=src
|
||||
python -m pytest --cov=src/fiona
|
||||
```
|
||||
|
||||
## Development Tools
|
||||
@@ -98,9 +114,10 @@ The project includes several development utilities:
|
||||
|
||||
- `bootstrap`: Set up the Python development environment (bash)
|
||||
- `bootstrap.ps1`: Set up the Python development environment (PowerShell)
|
||||
- `src/utils.sh`: Shell utility functions
|
||||
- `src/install_packages.sh`: Install local Python packages
|
||||
- `src/run_tests.sh`: Run the test suite
|
||||
- `scripts/utils.sh`: Shell utility functions
|
||||
- `scripts/install_packages.sh`: Install local Python packages
|
||||
- `scripts/run_tests.py`: Run the test suite
|
||||
- `scripts/run_sanity.py`: Run tests and linters
|
||||
|
||||
## License
|
||||
|
||||
@@ -108,4 +125,6 @@ GPL-3.0-only
|
||||
|
||||
## Contributing
|
||||
|
||||
[Contribution guidelines to be added]
|
||||
Follow [AGENTS.md](../AGENTS.md): update [SPEC.md](../SPEC.md) first,
|
||||
add a failing test, then implement. Run `python scripts/run_tests.py`
|
||||
and `python scripts/run_sanity.py --non-interactive` before finishing.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
# Fiona tools package
|
||||
+11
-11
@@ -8,18 +8,18 @@ import argparse
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from customlinter.fmlint import main as fmlint_main
|
||||
from customlinter.jsonlint import main as jsonlint_main
|
||||
from fiona.customlinter.fmlint import main as fmlint_main
|
||||
from fiona.customlinter.jsonlint import main as jsonlint_main
|
||||
from fiona.gittool.git_tool import main as git_tool_main
|
||||
from fiona.librarian.librarian import main as librarian_main
|
||||
from fiona.librarian.toc_generator import main as toc_generator_main
|
||||
from fiona.logging_config import setup_logging
|
||||
from gittool.git_tool import main as git_tool_main
|
||||
from librarian.librarian import main as librarian_main
|
||||
from librarian.toc_generator import main as toc_generator_main
|
||||
from mdoctor.mdoctor import main as mdoctor_main
|
||||
from python_ruff.python_ruff import main as python_ruff_main
|
||||
from wiki.graph_generator import wiki_graph_main
|
||||
from wiki.sanity_manager import sanity_main
|
||||
from wiki.update_manager import check_update_main, update_main
|
||||
from wiki.wiki import wiki_init
|
||||
from fiona.mdoctor.mdoctor import main as mdoctor_main
|
||||
from fiona.python_ruff.python_ruff import main as python_ruff_main
|
||||
from fiona.wiki.graph_generator import wiki_graph_main
|
||||
from fiona.wiki.sanity_manager import sanity_main
|
||||
from fiona.wiki.update_manager import check_update_main, update_main
|
||||
from fiona.wiki.wiki import wiki_init
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -16,7 +16,7 @@ various code and content rules. It includes:
|
||||
All linters share a common interface and output format for consistency.
|
||||
"""
|
||||
|
||||
from customlinter.base import (
|
||||
from fiona.customlinter.base import (
|
||||
DEFAULT_SETTINGS_FILE,
|
||||
READONLY_ZONES,
|
||||
BaseLinter,
|
||||
@@ -25,9 +25,9 @@ from customlinter.base import (
|
||||
LinterError,
|
||||
LintViolation,
|
||||
)
|
||||
from customlinter.fmlint import FrontmatterLinter
|
||||
from customlinter.mdlinter import MarkdownLinter
|
||||
from customlinter.pycustomlint import PythonCustomLinter
|
||||
from fiona.customlinter.fmlint import FrontmatterLinter
|
||||
from fiona.customlinter.mdlinter import MarkdownLinter
|
||||
from fiona.customlinter.pycustomlint import PythonCustomLinter
|
||||
|
||||
__all__ = [
|
||||
"DEFAULT_SETTINGS_FILE",
|
||||
@@ -15,6 +15,8 @@ import pathlib
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from fiona.paths import llm_wiki_template
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -40,9 +42,7 @@ def report_path(path: pathlib.Path | str) -> str:
|
||||
READONLY_ZONES = ["personal", "raw"]
|
||||
|
||||
# Default settings file path
|
||||
DEFAULT_SETTINGS_FILE = (
|
||||
pathlib.Path(__file__).resolve().parent.parent / "llm-wiki" / "fiona-settings.json"
|
||||
)
|
||||
DEFAULT_SETTINGS_FILE = llm_wiki_template() / "fiona-settings.json"
|
||||
|
||||
# Re-export constants for backward compatibility
|
||||
__all__ = [
|
||||
@@ -26,14 +26,14 @@ import pathlib
|
||||
import re
|
||||
import sys
|
||||
|
||||
from customlinter.base import (
|
||||
from fiona.customlinter.base import (
|
||||
BaseLinter,
|
||||
FrontmatterLintError,
|
||||
LintViolation,
|
||||
report_path,
|
||||
)
|
||||
from fiona.librarian.md_frontmatter import FrontmatterError, parse_frontmatter
|
||||
from fiona.logging_config import setup_logging
|
||||
from librarian.md_frontmatter import FrontmatterError, parse_frontmatter
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -9,7 +9,7 @@ Includes support for:
|
||||
- Key ordering (optional)
|
||||
- Auto-fixing certain violations
|
||||
|
||||
Follows the BaseLinter pattern from customlinter.base.
|
||||
Follows the BaseLinter pattern from fiona.customlinter.base.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -21,7 +21,7 @@ import re
|
||||
import sys
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from customlinter.base import BaseLinter, LinterError, LintViolation
|
||||
from fiona.customlinter.base import BaseLinter, LinterError, LintViolation
|
||||
from fiona.logging_config import setup_logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -27,7 +27,7 @@ import pathlib
|
||||
import re
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from customlinter.base import BaseLinter, LinterError, LintViolation
|
||||
from fiona.customlinter.base import BaseLinter, LinterError, LintViolation
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -238,7 +238,7 @@ class MarkdownLinter(BaseLinter):
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Module-level Dead Link Helper (moved from wiki.sanity_manager)
|
||||
# Module-level Dead Link Helper (moved from fiona.wiki.sanity_manager)
|
||||
# =============================================================================
|
||||
|
||||
def find_dead_links(wiki_root: pathlib.Path) -> list[LintViolation]:
|
||||
@@ -25,7 +25,7 @@ import pathlib
|
||||
import sys
|
||||
from typing import ClassVar
|
||||
|
||||
from customlinter.base import (
|
||||
from fiona.customlinter.base import (
|
||||
BaseLinter,
|
||||
CustomLintError,
|
||||
LintViolation,
|
||||
+3
-3
@@ -4,7 +4,7 @@ category: productivity
|
||||
description: Operate an llm-wiki with the fiona-assistant CLI.
|
||||
author: nvaldez
|
||||
license: MIT
|
||||
version: 1.2.0
|
||||
version: 1.2.1
|
||||
updated: 2026-09-29
|
||||
---
|
||||
|
||||
@@ -472,6 +472,6 @@ These are not implemented. Do not invent flags for them.
|
||||
- `fiona-assistant python-ruff fix`
|
||||
|
||||
On a checkout of the fiona-assistant product repository, tests and
|
||||
the product gate are `python src/run_tests.py` and
|
||||
`python src/run_sanity.py --non-interactive`. Those are not wiki
|
||||
the product gate are `python scripts/run_tests.py` and
|
||||
`python scripts/run_sanity.py --non-interactive`. Those are not wiki
|
||||
commands. A wiki uses `fiona-assistant wiki sanity`.
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: log
|
||||
title: Wiki Log
|
||||
version: 1.2.7
|
||||
version: 1.2.8
|
||||
type: summary
|
||||
created: 2025-09-23
|
||||
updated: 2026-09-29
|
||||
@@ -57,6 +57,8 @@ Chronological tracking of all actions performed on the wiki.
|
||||
`progress` section with `interval` and `expected-seconds` keys.
|
||||
- 2026-09-29 - Retargeted spec citations in this log, `todo.md`, and
|
||||
the code to the current section numbers.
|
||||
- 2026-09-29 - Moved the template to `src/fiona/data/llm_wiki/` as
|
||||
package data (no importable `llm-wiki` package). Fiona skill v1.2.1.
|
||||
- 2026-09-29 - Restored the development lifecycle as project agent
|
||||
rule 2.1 (AGENTS.md v1.4.1) and linked the python-tdd skill.
|
||||
- 2026-09-29 - PYC001 allows a module-level if/else import before
|
||||
@@ -7,7 +7,7 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import pathlib
|
||||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import git
|
||||
from git.repo.base import Repo
|
||||
@@ -50,7 +50,7 @@ class GitTool:
|
||||
Returns:
|
||||
str: Formatted timestamp string.
|
||||
"""
|
||||
return datetime.now(tz=timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
||||
return datetime.now(tz=UTC).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
@staticmethod
|
||||
def _get_tag_timestamp() -> str:
|
||||
@@ -62,7 +62,7 @@ class GitTool:
|
||||
Returns:
|
||||
str: Formatted timestamp string safe for git tags.
|
||||
"""
|
||||
return datetime.now(tz=timezone.utc).strftime("%Y-%m-%d_%H-%M-%S")
|
||||
return datetime.now(tz=UTC).strftime("%Y-%m-%d_%H-%M-%S")
|
||||
|
||||
def _is_working_tree_clean(self) -> bool:
|
||||
"""Check if the working tree is clean.
|
||||
@@ -16,8 +16,9 @@ import re
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from fiona.librarian.md_frontmatter import FrontmatterError, get_file_version
|
||||
from fiona.logging_config import load_settings, setup_logging
|
||||
from librarian.md_frontmatter import FrontmatterError, get_file_version
|
||||
from fiona.paths import llm_wiki_template
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -40,9 +41,7 @@ SETTINGS_NAME = "fiona-settings.json"
|
||||
ARTIFACT_DIR_NAMES = frozenset({"build", "dist", "__pycache__"})
|
||||
FILE_TOC_KEYS = frozenset({"min_heading", "max_heading", "sectionize", "ignore_files"})
|
||||
|
||||
DEFAULT_SETTINGS_FILE = (
|
||||
pathlib.Path(__file__).resolve().parent.parent / "llm-wiki" / "fiona-settings.json"
|
||||
)
|
||||
DEFAULT_SETTINGS_FILE = llm_wiki_template() / "fiona-settings.json"
|
||||
|
||||
|
||||
def load_toc_settings(settings_file: str | pathlib.Path | None = None) -> dict:
|
||||
@@ -170,7 +169,7 @@ def build_toc(
|
||||
(3 = h1 through h3). None or 0 mean unlimited.
|
||||
"""
|
||||
# Add YAML frontmatter
|
||||
today = datetime.datetime.now(datetime.timezone.utc).date().isoformat()
|
||||
today = datetime.datetime.now(datetime.UTC).date().isoformat()
|
||||
frontmatter = f"""---
|
||||
title: Table of Contents
|
||||
created: {today}
|
||||
@@ -20,18 +20,18 @@ import os
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
from fiona.paths import llm_wiki_template
|
||||
|
||||
# AI/LLM: Windows-only; module-level so PYC001 allows it (SPEC 6.4.2).
|
||||
if os.name == "nt":
|
||||
import msvcrt
|
||||
|
||||
DEFAULT_LOG_LEVEL = "WARNING"
|
||||
DEFAULT_SETTINGS_FILE = (
|
||||
pathlib.Path(__file__).resolve().parent.parent / "llm-wiki" / "fiona-settings.json"
|
||||
)
|
||||
DEFAULT_SETTINGS_FILE = llm_wiki_template() / "fiona-settings.json"
|
||||
# Tool package loggers that carry the level explicitly: pymarkdown
|
||||
# resets the root logger to WARNING mid-run, which would otherwise
|
||||
# silence tool diagnostics (same pattern as run_sanity, see SPEC 7.20).
|
||||
TOOL_LOGGER_NAMES = ("fiona", "librarian", "mdoctor", "python_ruff", "wiki")
|
||||
TOOL_LOGGER_NAMES = ("fiona",)
|
||||
|
||||
LOG_FORMAT = "%(levelname)s %(name)s: %(message)s"
|
||||
FILE_LOG_FORMAT = "%(asctime)s %(levelname)s %(name)s: %(message)s"
|
||||
|
||||
@@ -15,13 +15,12 @@ from typing import Any, ClassVar
|
||||
|
||||
from pymarkdown.api import PyMarkdownApi, PyMarkdownApiException
|
||||
|
||||
from customlinter.base import BaseLinter, LintViolation
|
||||
from fiona.customlinter.base import BaseLinter, LintViolation
|
||||
from fiona.librarian.librarian import Librarian
|
||||
from fiona.logging_config import setup_logging
|
||||
from librarian.librarian import Librarian
|
||||
from fiona.paths import llm_wiki_template
|
||||
|
||||
DEFAULT_SETTINGS_FILE = (
|
||||
pathlib.Path(__file__).resolve().parent.parent / "llm-wiki" / "fiona-settings.json"
|
||||
)
|
||||
DEFAULT_SETTINGS_FILE = llm_wiki_template() / "fiona-settings.json"
|
||||
# AI/LLM: MD013 defaults used when fiona-settings.json omits the keys.
|
||||
MD013_DEFAULTS: dict[str, int | bool] = {
|
||||
"line_length": 100,
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Filesystem locations for packaged Fiona data.
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - one resolver for the llm-wiki template.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.resources
|
||||
import pathlib
|
||||
|
||||
|
||||
def llm_wiki_template() -> pathlib.Path:
|
||||
"""Return the packaged llm-wiki template directory.
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - load package data with importlib.resources.
|
||||
|
||||
Returns:
|
||||
Filesystem path of ``fiona/data/llm_wiki``.
|
||||
"""
|
||||
resource = importlib.resources.files("fiona").joinpath("data", "llm_wiki")
|
||||
return pathlib.Path(str(resource))
|
||||
@@ -8,7 +8,7 @@ from typing import Any, ClassVar
|
||||
|
||||
import ruff
|
||||
|
||||
from customlinter.base import BaseLinter, LintViolation
|
||||
from fiona.customlinter.base import BaseLinter, LintViolation
|
||||
from fiona.logging_config import setup_logging
|
||||
|
||||
|
||||
@@ -17,18 +17,35 @@ import time
|
||||
from collections.abc import Callable, Sequence
|
||||
from pathlib import Path
|
||||
|
||||
import sanity_runner
|
||||
from customlinter.fmlint import FrontmatterLinter
|
||||
from customlinter.jsonlint import JsonLinter
|
||||
from customlinter.pycustomlint import PythonCustomLinter
|
||||
from mdoctor.mdoctor import MDoctor
|
||||
from python_ruff.python_ruff import PythonRuff
|
||||
from run_tests import TestRunner
|
||||
from fiona import sanity_runner
|
||||
from fiona.customlinter.fmlint import FrontmatterLinter
|
||||
from fiona.customlinter.jsonlint import JsonLinter
|
||||
from fiona.customlinter.pycustomlint import PythonCustomLinter
|
||||
from fiona.mdoctor.mdoctor import MDoctor
|
||||
from fiona.python_ruff.python_ruff import PythonRuff
|
||||
from fiona.run_tests import TestRunner
|
||||
|
||||
# Configure logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
SETTINGS_FILE = Path(__file__).resolve().parent / "settings_dev.json"
|
||||
|
||||
def dev_settings_file() -> Path:
|
||||
"""Return scripts/settings_dev.json from the checkout that contains this file.
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - development settings live outside the package.
|
||||
|
||||
Returns:
|
||||
The settings file when this module sits in a checkout, otherwise a
|
||||
path relative to the current working directory.
|
||||
"""
|
||||
for parent in Path(__file__).resolve().parents:
|
||||
candidate = parent / "scripts" / "settings_dev.json"
|
||||
if candidate.is_file():
|
||||
return candidate
|
||||
return Path("scripts") / "settings_dev.json"
|
||||
|
||||
|
||||
SETTINGS_FILE = dev_settings_file()
|
||||
|
||||
# Progress display defaults (overridable via the "progress" settings
|
||||
# section, see load_progress_settings)
|
||||
@@ -57,7 +74,7 @@ def configure_logging() -> None:
|
||||
# pymarkdown resets the root logger to WARNING during lint scans,
|
||||
# which would silence the runner's debug output mid-run; the module
|
||||
# loggers therefore also carry the level explicitly
|
||||
for logger_name in (__name__, "run_sanity", "run_tests"):
|
||||
for logger_name in (__name__, "fiona.run_tests"):
|
||||
logging.getLogger(logger_name).setLevel(level)
|
||||
|
||||
|
||||
@@ -92,8 +109,11 @@ def load_progress_settings(settings_file: str | Path = SETTINGS_FILE) -> dict:
|
||||
Each falls back to its default when the "progress" section or
|
||||
the individual key is absent.
|
||||
"""
|
||||
with open(settings_file, encoding="utf-8") as f:
|
||||
settings = json.load(f)
|
||||
try:
|
||||
with open(settings_file, encoding="utf-8") as f:
|
||||
settings = json.load(f)
|
||||
except FileNotFoundError:
|
||||
settings = {}
|
||||
progress = settings.get("progress", {})
|
||||
return {
|
||||
"interval_seconds": float(
|
||||
@@ -261,7 +281,7 @@ def run_pytests():
|
||||
(or the raw message when no traceback details exist)
|
||||
"""
|
||||
runner = TestRunner()
|
||||
result = runner.run_pytest("src/tests", verbose=True, capture_output=True, with_coverage=True)
|
||||
result = runner.run_pytest("tests", verbose=True, capture_output=True, with_coverage=True)
|
||||
|
||||
required_coverage = load_required_coverage()
|
||||
coverage_percent = result.get("coverage_percent")
|
||||
@@ -293,7 +313,7 @@ def run_pytests():
|
||||
unreported_failures,
|
||||
)
|
||||
|
||||
lines = ["Pytest Results", "TARGET: src/tests", ""]
|
||||
lines = ["Pytest Results", "TARGET: tests", ""]
|
||||
lines.append(f"Tests: {result['passed_count']}/{result['total_count']} passed")
|
||||
for file_name in sorted(file_results):
|
||||
counts = file_results[file_name]
|
||||
@@ -429,7 +449,7 @@ def run_frontmatter_lint():
|
||||
linter = FrontmatterLinter()
|
||||
|
||||
# Lint markdown files in llm-wiki directory only (per project agent rule 10.1)
|
||||
llm_wiki_path = "./src/llm-wiki"
|
||||
llm_wiki_path = "./src/fiona/data/llm_wiki"
|
||||
violations_dict = linter.lint_directory(llm_wiki_path)
|
||||
|
||||
# Get violation count from meta
|
||||
@@ -22,6 +22,8 @@ logger = logging.getLogger(__name__)
|
||||
class TestRunner:
|
||||
"""A test runner for Fiona tools that can be used both manually and in CI."""
|
||||
|
||||
__test__ = False
|
||||
|
||||
def __init__(self, base_dir: str | None = None):
|
||||
"""
|
||||
Initialize the test runner.
|
||||
@@ -464,7 +466,7 @@ class TestRunner:
|
||||
if verbose:
|
||||
cmd.append("-v")
|
||||
if with_coverage:
|
||||
cmd.extend(["--cov=src", "--cov-config=.coveragerc", "--cov-report=term"])
|
||||
cmd.extend(["--cov=src/fiona", "--cov-report=term"])
|
||||
if ignore:
|
||||
cmd.extend(["--ignore-glob", f"*{ignore}*"])
|
||||
|
||||
@@ -477,9 +479,9 @@ class TestRunner:
|
||||
# environment variables (PY_COLORS, FORCE_COLOR) would break them
|
||||
cmd.append("--color=no")
|
||||
|
||||
# Set PYTHONPATH to include src directory for customlinter imports
|
||||
# Set PYTHONPATH to include src so the fiona package resolves
|
||||
env = os.environ.copy()
|
||||
src_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
src_dir = str(pathlib.Path(__file__).resolve().parent.parent)
|
||||
if os.path.exists(src_dir):
|
||||
current_pythonpath = env.get("PYTHONPATH", "")
|
||||
if current_pythonpath:
|
||||
@@ -572,7 +574,7 @@ class TestRunner:
|
||||
True if all tests passed, False otherwise
|
||||
"""
|
||||
test_paths = [
|
||||
"src/tests"
|
||||
"tests"
|
||||
]
|
||||
|
||||
all_passed = True
|
||||
@@ -6,7 +6,7 @@ repository sanity runner (run_sanity) and the wiki sanity command
|
||||
timings and the common AI-friendly report format (SPEC 6.1/7.16.1).
|
||||
"""
|
||||
|
||||
from sanity_runner.sanity_runner import (
|
||||
from fiona.sanity_runner.sanity_runner import (
|
||||
SanityRunner,
|
||||
format_duration,
|
||||
format_violation_count,
|
||||
@@ -3,7 +3,7 @@
|
||||
This module provides `SanityRunner`, the generalized class behind both
|
||||
sanity runners in the project:
|
||||
|
||||
- the repository sanity runner (`src/run_sanity.py`, SPEC 7.16)
|
||||
- the repository sanity runner (`fiona.run_sanity`, SPEC 7.16)
|
||||
- the wiki sanity command (`src/wiki/sanity_manager.py`, SPEC 7.3)
|
||||
|
||||
The class owns the common machinery: concurrent check execution with
|
||||
@@ -3,6 +3,6 @@
|
||||
This module provides functionality for initializing and managing llm-wiki directories.
|
||||
"""
|
||||
|
||||
from wiki.wiki import wiki_init
|
||||
from fiona.wiki.wiki import wiki_init
|
||||
|
||||
__all__ = ["wiki_init"]
|
||||
@@ -570,7 +570,7 @@ class HTMLGraphRenderer:
|
||||
"wiki_root": wiki_root,
|
||||
"file_count": len(self.graph.nodes),
|
||||
"link_count": sum(self.graph.edges.values()),
|
||||
"generated_at": datetime.datetime.now(datetime.timezone.utc).isoformat()
|
||||
"generated_at": datetime.datetime.now(datetime.UTC).isoformat()
|
||||
},
|
||||
"nodes": self._generate_node_data(),
|
||||
"edges": self._generate_edge_data(),
|
||||
@@ -23,14 +23,13 @@ import time
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
import run_sanity
|
||||
import sanity_runner
|
||||
from customlinter.base import LintViolation
|
||||
from customlinter.fmlint import FrontmatterLinter
|
||||
from customlinter.jsonlint import JsonLinter
|
||||
from customlinter.mdlinter import MarkdownLinter
|
||||
from mdoctor.mdoctor import MDoctor
|
||||
from python_ruff.python_ruff import PythonRuff
|
||||
from fiona import run_sanity, sanity_runner
|
||||
from fiona.customlinter.base import LintViolation
|
||||
from fiona.customlinter.fmlint import FrontmatterLinter
|
||||
from fiona.customlinter.jsonlint import JsonLinter
|
||||
from fiona.customlinter.mdlinter import MarkdownLinter
|
||||
from fiona.mdoctor.mdoctor import MDoctor
|
||||
from fiona.python_ruff.python_ruff import PythonRuff
|
||||
|
||||
SETTINGS_FILE = "fiona-settings.json"
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
from fiona.librarian.md_frontmatter import get_file_version
|
||||
from fiona.librarian.toc_generator import path_matches
|
||||
from fiona.logging_config import setup_logging
|
||||
from librarian.md_frontmatter import get_file_version
|
||||
from librarian.toc_generator import path_matches
|
||||
from wiki.wiki import _copy_file, get_ignore_patterns, replace_date_placeholders
|
||||
from fiona.paths import llm_wiki_template
|
||||
from fiona.wiki.wiki import _copy_file, get_ignore_patterns, replace_date_placeholders
|
||||
|
||||
# =============================================================================
|
||||
# Data Classes
|
||||
@@ -108,39 +109,30 @@ READ_ONLY_ZONES = ["personal/", "raw/"]
|
||||
|
||||
def get_llm_wiki_source_path() -> Path:
|
||||
"""Get the path to the llm-wiki source directory in the package.
|
||||
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - template ships as package data.
|
||||
|
||||
Returns:
|
||||
Path: The path to the llm-wiki source directory.
|
||||
"""
|
||||
# The llm-wiki directory is in the same parent as this wiki module
|
||||
# src/wiki/ -> src/llm-wiki/
|
||||
wiki_dir = Path(__file__).parent
|
||||
llm_wiki_dir = wiki_dir.parent / "llm-wiki"
|
||||
|
||||
if not llm_wiki_dir.exists():
|
||||
# Fallback: check if we're in a development environment
|
||||
# Go up to src directory and look for llm-wiki
|
||||
src_dir = wiki_dir.parent
|
||||
llm_wiki_dir = src_dir / "llm-wiki"
|
||||
|
||||
return llm_wiki_dir
|
||||
return llm_wiki_template()
|
||||
|
||||
|
||||
def calculate_sha256(file_path: Path) -> str:
|
||||
"""Calculate SHA256 hash of a file.
|
||||
|
||||
|
||||
Args:
|
||||
file_path: Path to the file.
|
||||
|
||||
|
||||
Returns:
|
||||
str: The SHA256 hash as a hexadecimal string.
|
||||
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If the file does not exist.
|
||||
"""
|
||||
if not file_path.exists():
|
||||
raise FileNotFoundError(f"File not found: {file_path}")
|
||||
|
||||
|
||||
sha256_hash = hashlib.sha256()
|
||||
with open(file_path, "rb") as f:
|
||||
for byte_block in iter(lambda: f.read(4096), b""):
|
||||
@@ -150,32 +142,32 @@ def calculate_sha256(file_path: Path) -> str:
|
||||
|
||||
def is_core_file(file_path: Path, wiki_root: Path) -> bool:
|
||||
"""Check if a file is a core file (part of the package).
|
||||
|
||||
|
||||
Args:
|
||||
file_path: Path to the file to check.
|
||||
wiki_root: Root path of the wiki.
|
||||
|
||||
|
||||
Returns:
|
||||
bool: True if the file is a core file, False otherwise (user-created).
|
||||
"""
|
||||
# Get relative path from wiki root
|
||||
# Get relative path from fiona.wiki root
|
||||
try:
|
||||
relative_path = file_path.relative_to(wiki_root)
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
relative_str = relative_path.as_posix()
|
||||
file_name = file_path.name
|
||||
|
||||
|
||||
# Check if it's a core file by name
|
||||
if file_name in CORE_FILES:
|
||||
return True
|
||||
|
||||
|
||||
# Check if it's in a core directory
|
||||
for core_dir in CORE_DIRECTORIES:
|
||||
if relative_str.startswith(f"{core_dir}/"):
|
||||
return True
|
||||
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -419,16 +411,16 @@ def find_missing_directories(wiki_root: Path, template_dir: Path) -> list[Path]:
|
||||
|
||||
def check_wiki_updates(directory: str | Path = ".") -> UpdateSummary:
|
||||
"""Check if there are updates available for the wiki.
|
||||
|
||||
|
||||
This function compares all core files in the wiki against the packaged template
|
||||
and returns a summary of files that need to be updated or added.
|
||||
|
||||
|
||||
Args:
|
||||
directory: The wiki directory to check. Defaults to current directory.
|
||||
|
||||
|
||||
Returns:
|
||||
UpdateSummary: Summary of all files that need updates.
|
||||
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If the wiki directory does not exist.
|
||||
NotADirectoryError: If the directory is not an llm-wiki directory.
|
||||
@@ -547,10 +539,10 @@ def update_core_files(directory: str | Path = ".", force: bool = False, yes: boo
|
||||
yes: If True, perform update without prompting.
|
||||
verbose: If True, print the update plan and skipped files. Set to
|
||||
False for machine-readable (JSON) CLI output.
|
||||
|
||||
|
||||
Returns:
|
||||
UpdateSummary: Summary of files that were updated.
|
||||
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If the wiki directory does not exist.
|
||||
NotADirectoryError: If the directory is not an llm-wiki directory.
|
||||
@@ -727,7 +719,7 @@ def update_main(
|
||||
dry_run: bool = False
|
||||
) -> int:
|
||||
"""Main function for the 'wiki update' CLI command.
|
||||
|
||||
|
||||
Args:
|
||||
directory: Wiki directory to update (default: current directory).
|
||||
force: If True, perform update without prompting (alias for yes).
|
||||
@@ -782,7 +774,7 @@ def update_main(
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
except (FileNotFoundError, NotADirectoryError) as e:
|
||||
print(f"Error: {e}", file=sys.stderr)
|
||||
return 1
|
||||
@@ -8,34 +8,26 @@ from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from collections.abc import Sequence
|
||||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
|
||||
import git
|
||||
|
||||
from fiona.gittool.git_tool import GitTool
|
||||
from fiona.librarian.toc_generator import path_matches
|
||||
from fiona.logging_config import load_settings
|
||||
from gittool.git_tool import GitTool
|
||||
from librarian.toc_generator import path_matches
|
||||
from fiona.paths import llm_wiki_template
|
||||
|
||||
|
||||
def get_llm_wiki_source_path() -> Path:
|
||||
"""Get the path to the llm-wiki source directory.
|
||||
|
||||
Generated by AI/LLM: 2026-09-29 - template ships as package data.
|
||||
|
||||
Returns:
|
||||
Path: The path to the llm-wiki source directory.
|
||||
"""
|
||||
# The llm-wiki directory is in the same parent as this wiki module
|
||||
# src/wiki/ -> src/llm-wiki/
|
||||
wiki_dir = Path(__file__).parent
|
||||
llm_wiki_dir = wiki_dir.parent / "llm-wiki"
|
||||
|
||||
if not llm_wiki_dir.exists():
|
||||
# Fallback: check if we're in a development environment
|
||||
# Go up to src directory and look for llm-wiki
|
||||
src_dir = wiki_dir.parent
|
||||
llm_wiki_dir = src_dir / "llm-wiki"
|
||||
|
||||
return llm_wiki_dir
|
||||
return llm_wiki_template()
|
||||
|
||||
|
||||
def get_ignore_patterns(source: Path) -> list[str]:
|
||||
@@ -69,7 +61,7 @@ def replace_date_placeholders(content: str) -> str:
|
||||
Returns:
|
||||
str: The content with placeholders replaced.
|
||||
"""
|
||||
date_stamp = datetime.now(tz=timezone.utc).strftime("%Y-%m-%d")
|
||||
date_stamp = datetime.now(tz=UTC).strftime("%Y-%m-%d")
|
||||
return content.replace("DATE_PLACEHOLDER", date_stamp)
|
||||
|
||||
|
||||
@@ -149,7 +141,7 @@ def wiki_init(directory: str = ".") -> str:
|
||||
"""Initialize a directory as an llm-wiki directory.
|
||||
|
||||
This function copies the complete llm-wiki template structure and files
|
||||
from the package's src/llm-wiki directory to the target directory.
|
||||
from the packaged llm-wiki template to the target directory.
|
||||
This ensures a 1:1 copy of the template.
|
||||
|
||||
It also initializes a git repository and makes the initial commit with
|
||||
@@ -1,4 +0,0 @@
|
||||
# llm-wiki package
|
||||
# This package contains templates and utilities for managing the LLM wiki.
|
||||
|
||||
__version__ = "0.1.0"
|
||||
@@ -1 +0,0 @@
|
||||
"""Tests package."""
|
||||
@@ -2,19 +2,15 @@
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# Add the src directory to the Python path so the tool packages resolve
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import pytest
|
||||
|
||||
from librarian.librarian import Librarian
|
||||
from mdoctor.mdoctor import MDoctor
|
||||
from python_ruff.python_ruff import PythonRuff
|
||||
from wiki.sanity_manager import run_wiki_checks
|
||||
from wiki.wiki import get_llm_wiki_source_path, wiki_init
|
||||
from fiona.librarian.librarian import Librarian
|
||||
from fiona.mdoctor.mdoctor import MDoctor
|
||||
from fiona.python_ruff.python_ruff import PythonRuff
|
||||
from fiona.wiki.sanity_manager import run_wiki_checks
|
||||
from fiona.wiki.wiki import get_llm_wiki_source_path, wiki_init
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -12,7 +12,7 @@ from typing import ClassVar
|
||||
|
||||
import pytest
|
||||
|
||||
from customlinter.base import (
|
||||
from fiona.customlinter.base import (
|
||||
DEFAULT_SETTINGS_FILE,
|
||||
READONLY_ZONES,
|
||||
BaseLinter,
|
||||
@@ -11,7 +11,7 @@ import pytest
|
||||
|
||||
from fiona import logging_config
|
||||
from fiona.__main__ import main
|
||||
from librarian import toc_generator
|
||||
from fiona.librarian import toc_generator
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -15,13 +15,13 @@ import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from customlinter.base import FrontmatterLintError, LintViolation
|
||||
from customlinter.fmlint import (
|
||||
from fiona.customlinter.base import FrontmatterLintError, LintViolation
|
||||
from fiona.customlinter.fmlint import (
|
||||
FrontmatterLinter,
|
||||
main,
|
||||
validate_file_frontmatter,
|
||||
)
|
||||
from librarian.md_frontmatter import FrontmatterError
|
||||
from fiona.librarian.md_frontmatter import FrontmatterError
|
||||
|
||||
# =============================================================================
|
||||
# Fixtures
|
||||
@@ -1222,7 +1222,7 @@ class TestLintFileDirect:
|
||||
# Mock parse_frontmatter to raise error; patch the binding that
|
||||
# lint_file actually uses (module-level, see python-tdd rule 0)
|
||||
mocker.patch(
|
||||
"customlinter.fmlint.parse_frontmatter",
|
||||
"fiona.customlinter.fmlint.parse_frontmatter",
|
||||
side_effect=FrontmatterError("Invalid frontmatter")
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import git
|
||||
import pytest
|
||||
|
||||
from gittool.git_tool import GitTool
|
||||
from fiona.gittool.git_tool import GitTool
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -6,7 +6,7 @@ Test cases for MarkdownLinkParser, WikiGraph, and HTMLGraphRenderer classes.
|
||||
import json
|
||||
import os
|
||||
|
||||
from wiki.graph_generator import (
|
||||
from fiona.wiki.graph_generator import (
|
||||
HTMLGraphRenderer,
|
||||
MarkdownLinkParser,
|
||||
WikiGraph,
|
||||
@@ -726,7 +726,7 @@ class TestWikiGraphMain:
|
||||
return False
|
||||
return real_access(path, mode)
|
||||
|
||||
monkeypatch.setattr("wiki.graph_generator.os.access", deny_directory_write)
|
||||
monkeypatch.setattr("fiona.wiki.graph_generator.os.access", deny_directory_write)
|
||||
|
||||
output_file = tmp_path / "graph.html"
|
||||
result = wiki_graph_main(
|
||||
@@ -13,11 +13,11 @@ from io import StringIO
|
||||
|
||||
import pytest
|
||||
|
||||
from customlinter.base import BaseLinter, LinterError, LintViolation
|
||||
from customlinter.jsonlint import JsonLinter, main
|
||||
from fiona.customlinter.base import BaseLinter, LinterError, LintViolation
|
||||
from fiona.customlinter.jsonlint import JsonLinter, main
|
||||
|
||||
# AI/LLM: the suite is not tied to a Linux checkout path.
|
||||
REPO_ROOT = pathlib.Path(__file__).resolve().parents[2]
|
||||
REPO_ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _run_jsonlint_cli(argv: list[str]) -> subprocess.CompletedProcess[str]:
|
||||
@@ -33,7 +33,7 @@ def _run_jsonlint_cli(argv: list[str]) -> subprocess.CompletedProcess[str]:
|
||||
The completed subprocess.
|
||||
"""
|
||||
script = (
|
||||
"from customlinter.jsonlint import main; import sys; "
|
||||
"from fiona.customlinter.jsonlint import main; import sys; "
|
||||
f"sys.argv = {argv!r}; main()"
|
||||
)
|
||||
return subprocess.run(
|
||||
@@ -1294,7 +1294,7 @@ def test_cli_default_subcommand():
|
||||
# Run without subcommand (should default to chklint)
|
||||
result = subprocess.run(
|
||||
[sys.executable, '-c',
|
||||
'from customlinter.jsonlint import main; import sys; sys.argv = ["jsonlint"]; main()'],
|
||||
'from fiona.customlinter.jsonlint import main; import sys; sys.argv = ["jsonlint"]; main()'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
@@ -1309,7 +1309,7 @@ def test_cli_chklint_with_nonexistent():
|
||||
"""Test CLI chklint with nonexistent directory."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, '-c',
|
||||
'from customlinter.jsonlint import main; import sys; sys.argv = ["jsonlint", "chklint", "/nonexistent/path"]; main()'],
|
||||
'from fiona.customlinter.jsonlint import main; import sys; sys.argv = ["jsonlint", "chklint", "/nonexistent/path"]; main()'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False
|
||||
@@ -1323,7 +1323,7 @@ def test_cli_fix_with_nonexistent():
|
||||
"""Test CLI fix with nonexistent directory."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, '-c',
|
||||
'from customlinter.jsonlint import main; import sys; sys.argv = ["jsonlint", "fix", "/nonexistent/path"]; main()'],
|
||||
'from fiona.customlinter.jsonlint import main; import sys; sys.argv = ["jsonlint", "fix", "/nonexistent/path"]; main()'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False
|
||||
@@ -8,7 +8,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from fiona import logging_config
|
||||
from librarian.librarian import main
|
||||
from fiona.librarian.librarian import main
|
||||
|
||||
|
||||
def test_list_all_files(librarian, temp_dir_with_files):
|
||||
@@ -145,7 +145,7 @@ class TestFileLogging:
|
||||
"file_log_location": str(location),
|
||||
}
|
||||
})
|
||||
logging.getLogger("librarian").info("hello file")
|
||||
logging.getLogger("fiona.librarian").info("hello file")
|
||||
content = location.read_text(encoding="utf-8")
|
||||
assert "hello file" in content
|
||||
assert "INFO" in content
|
||||
@@ -159,7 +159,7 @@ class TestFileLogging:
|
||||
"file_log_location": str(location),
|
||||
}
|
||||
})
|
||||
logging.getLogger("librarian").info("stamped")
|
||||
logging.getLogger("fiona.librarian").info("stamped")
|
||||
line = location.read_text(encoding="utf-8").strip()
|
||||
assert re.match(r"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}", line)
|
||||
|
||||
@@ -173,8 +173,8 @@ class TestFileLogging:
|
||||
"file_log_location": str(location),
|
||||
}
|
||||
})
|
||||
logging.getLogger("librarian").info("info record")
|
||||
logging.getLogger("librarian").error("error record")
|
||||
logging.getLogger("fiona.librarian").info("info record")
|
||||
logging.getLogger("fiona.librarian").error("error record")
|
||||
content = location.read_text(encoding="utf-8")
|
||||
assert "error record" in content
|
||||
assert "info record" not in content
|
||||
@@ -188,7 +188,7 @@ class TestFileLogging:
|
||||
"file_log_location": str(location),
|
||||
}
|
||||
})
|
||||
logging.getLogger("librarian").debug("debug record")
|
||||
logging.getLogger("fiona.librarian").debug("debug record")
|
||||
assert "debug record" in location.read_text(encoding="utf-8")
|
||||
|
||||
def test_no_location_adds_no_file_handler(self):
|
||||
@@ -209,7 +209,7 @@ class TestFileLogging:
|
||||
second = tmp_path / "second.log"
|
||||
setup_logging({"fiona": {"log_level": "INFO", "file_log_location": str(first)}})
|
||||
setup_logging({"fiona": {"log_level": "INFO", "file_log_location": str(second)}})
|
||||
logging.getLogger("librarian").info("moved record")
|
||||
logging.getLogger("fiona.librarian").info("moved record")
|
||||
assert "moved record" in second.read_text(encoding="utf-8")
|
||||
assert not first.exists() or "moved record" not in first.read_text(encoding="utf-8")
|
||||
|
||||
@@ -232,7 +232,7 @@ class TestFileLogging:
|
||||
}
|
||||
})
|
||||
assert "VERBOSE" in caplog.text
|
||||
logging.getLogger("librarian").info("fallback record")
|
||||
logging.getLogger("fiona.librarian").info("fallback record")
|
||||
assert "fallback record" in location.read_text(encoding="utf-8")
|
||||
|
||||
def test_unwritable_location_warns_and_continues(self, tmp_path, caplog):
|
||||
@@ -10,7 +10,7 @@ import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from librarian.md_frontmatter import (
|
||||
from fiona.librarian.md_frontmatter import (
|
||||
FrontmatterError,
|
||||
FrontmatterParser,
|
||||
RequiredFieldError,
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Tests for the MarkdownLinter (mdlinter) module.
|
||||
|
||||
Covers the custom markdown linter in the customlinter framework: the
|
||||
dead-link check (MDL001/MDL002, moved from wiki.sanity_manager), the
|
||||
dead-link check (MDL001/MDL002, moved from fiona.wiki.sanity_manager), the
|
||||
per-file check registry, and the shared linter report format
|
||||
(SPEC 6.1).
|
||||
"""
|
||||
@@ -13,9 +13,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from customlinter.base import LinterError
|
||||
from customlinter.mdlinter import MarkdownLinter, find_dead_links
|
||||
from wiki.wiki import get_llm_wiki_source_path
|
||||
from fiona.customlinter.base import LinterError
|
||||
from fiona.customlinter.mdlinter import MarkdownLinter, find_dead_links
|
||||
from fiona.wiki.wiki import get_llm_wiki_source_path
|
||||
|
||||
|
||||
def _write_md(path: Path, name: str, body: str, version: str = "1.0.0"):
|
||||
@@ -46,7 +46,7 @@ def linter(wiki):
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Dead Link Check Tests (moved from wiki.sanity_manager)
|
||||
# Dead Link Check Tests (moved from fiona.wiki.sanity_manager)
|
||||
# =============================================================================
|
||||
|
||||
class TestDeadLinkCheck:
|
||||
@@ -211,7 +211,7 @@ class TestLintFile:
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Module-level find_dead_links (moved from wiki.sanity_manager)
|
||||
# Module-level find_dead_links (moved from fiona.wiki.sanity_manager)
|
||||
# =============================================================================
|
||||
|
||||
class TestFindDeadLinks:
|
||||
@@ -10,7 +10,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
from pymarkdown.api import PyMarkdownApiException
|
||||
|
||||
from mdoctor.mdoctor import MDoctor, ProgrammaticLintViolation, main
|
||||
from fiona.mdoctor.mdoctor import MDoctor, ProgrammaticLintViolation, main
|
||||
|
||||
|
||||
class TestMDoctor:
|
||||
@@ -353,7 +353,7 @@ class TestMDoctorFix:
|
||||
"""Test main() reports pymarkdown API failures instead of crashing."""
|
||||
with tempfile.TemporaryDirectory() as temp_dir, \
|
||||
patch('sys.argv', ['mdoctor', 'fix', temp_dir]), \
|
||||
patch('mdoctor.mdoctor.MDoctor.fix_file_programmatically',
|
||||
patch('fiona.mdoctor.mdoctor.MDoctor.fix_file_programmatically',
|
||||
side_effect=PyMarkdownApiException("api failure")):
|
||||
with pytest.raises(SystemExit) as exc_info:
|
||||
main()
|
||||
@@ -8,8 +8,8 @@ import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from customlinter.base import CustomLintError
|
||||
from customlinter.pycustomlint import (
|
||||
from fiona.customlinter.base import CustomLintError
|
||||
from fiona.customlinter.pycustomlint import (
|
||||
READONLY_ZONES,
|
||||
VIOLATION_CODES,
|
||||
InlineImportVisitor,
|
||||
@@ -8,7 +8,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from python_ruff.python_ruff import PythonRuff, main
|
||||
from fiona.python_ruff.python_ruff import PythonRuff, main
|
||||
|
||||
|
||||
class TestPythonRuff:
|
||||
@@ -194,14 +194,14 @@ class TestPythonRuffEdgeCases:
|
||||
|
||||
def test_lint_with_fix_passes_flag(self, pyruff):
|
||||
"""Test lint(fix=True) passes --fix to the ruff binary."""
|
||||
with patch('python_ruff.python_ruff.subprocess.run') as mock_run:
|
||||
with patch('fiona.python_ruff.python_ruff.subprocess.run') as mock_run:
|
||||
mock_run.return_value = MagicMock(returncode=0, stdout="[]", stderr="")
|
||||
pyruff.lint("src", fix=True)
|
||||
assert "--fix" in mock_run.call_args[0][0]
|
||||
|
||||
def test_lint_non_list_json_returns_empty(self, pyruff):
|
||||
"""Test lint returns [] when ruff emits a non-list JSON payload."""
|
||||
with patch('python_ruff.python_ruff.subprocess.run') as mock_run:
|
||||
with patch('fiona.python_ruff.python_ruff.subprocess.run') as mock_run:
|
||||
mock_run.return_value = MagicMock(
|
||||
returncode=0, stdout='{"violations": []}', stderr=""
|
||||
)
|
||||
@@ -9,12 +9,12 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
import run_sanity
|
||||
from customlinter.base import LintViolation
|
||||
from customlinter.pycustomlint import PythonCustomLinter
|
||||
from mdoctor.mdoctor import MDoctor
|
||||
from python_ruff.python_ruff import PythonRuff
|
||||
from run_tests import TestRunner
|
||||
import fiona.run_sanity as run_sanity
|
||||
from fiona.customlinter.base import LintViolation
|
||||
from fiona.customlinter.pycustomlint import PythonCustomLinter
|
||||
from fiona.mdoctor.mdoctor import MDoctor
|
||||
from fiona.python_ruff.python_ruff import PythonRuff
|
||||
from fiona.run_tests import TestRunner
|
||||
|
||||
|
||||
def _make_pytest_result(passed_count=1, failed_count=0, coverage_percent=95.0,
|
||||
@@ -59,7 +59,7 @@ def required_coverage_95(monkeypatch):
|
||||
@pytest.fixture
|
||||
def mock_test_runner():
|
||||
"""Patch TestRunner inside run_sanity to avoid running real tests."""
|
||||
with patch("run_sanity.TestRunner") as runner_class:
|
||||
with patch("fiona.run_sanity.TestRunner") as runner_class:
|
||||
yield runner_class
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ class TestRunPytests:
|
||||
},
|
||||
],
|
||||
)
|
||||
with caplog.at_level(logging.DEBUG, logger="run_sanity"):
|
||||
with caplog.at_level(logging.DEBUG, logger="fiona.run_sanity"):
|
||||
run_sanity.run_pytests()
|
||||
assert "src/tests/test_a.py::TestX::test_one" in caplog.text
|
||||
|
||||
@@ -218,7 +218,7 @@ class TestRunPytests:
|
||||
},
|
||||
failed_tests=[],
|
||||
)
|
||||
with caplog.at_level(logging.WARNING, logger="run_sanity"):
|
||||
with caplog.at_level(logging.WARNING, logger="fiona.run_sanity"):
|
||||
run_sanity.run_pytests()
|
||||
assert "no failure details" in caplog.text
|
||||
|
||||
@@ -243,7 +243,7 @@ class TestRunPytests:
|
||||
},
|
||||
failed_tests=[duplicate, dict(duplicate)],
|
||||
)
|
||||
with caplog.at_level(logging.WARNING, logger="run_sanity"):
|
||||
with caplog.at_level(logging.WARNING, logger="fiona.run_sanity"):
|
||||
run_sanity.run_pytests()
|
||||
assert "no failure details" not in caplog.text
|
||||
|
||||
@@ -293,17 +293,17 @@ class TestConfigureLogging:
|
||||
monkeypatch.setenv("LOG_LEVEL", "DEBUG")
|
||||
run_sanity.configure_logging()
|
||||
assert root.level == logging.DEBUG
|
||||
assert logging.getLogger("run_sanity").level == logging.DEBUG
|
||||
assert logging.getLogger("run_tests").level == logging.DEBUG
|
||||
assert logging.getLogger("fiona.run_sanity").level == logging.DEBUG
|
||||
assert logging.getLogger("fiona.run_tests").level == logging.DEBUG
|
||||
|
||||
monkeypatch.setenv("LOG_LEVEL", "INFO")
|
||||
run_sanity.configure_logging()
|
||||
assert root.level == logging.INFO
|
||||
assert logging.getLogger("run_sanity").level == logging.INFO
|
||||
assert logging.getLogger("run_tests").level == logging.INFO
|
||||
assert logging.getLogger("fiona.run_sanity").level == logging.INFO
|
||||
assert logging.getLogger("fiona.run_tests").level == logging.INFO
|
||||
finally:
|
||||
root.setLevel(old_level)
|
||||
for name in ("run_sanity", "run_tests"):
|
||||
for name in ("fiona.run_sanity", "fiona.run_tests"):
|
||||
logging.getLogger(name).setLevel(logging.NOTSET)
|
||||
|
||||
def test_default_level_is_warning(self, monkeypatch):
|
||||
@@ -338,7 +338,7 @@ def _make_md_violation(scan_file=".", line=3, column=1,
|
||||
def mock_mdoctor():
|
||||
"""Patch MDoctor inside run_sanity, keeping the real violation formatting."""
|
||||
real_mdoctor = MDoctor()
|
||||
with patch("run_sanity.MDoctor") as doctor_class:
|
||||
with patch("fiona.run_sanity.MDoctor") as doctor_class:
|
||||
instance = doctor_class.return_value
|
||||
instance.compress_violations.side_effect = real_mdoctor.compress_violations
|
||||
instance.format_violations.side_effect = real_mdoctor.format_violations
|
||||
@@ -361,7 +361,7 @@ def _make_ruff_violation(filename, row=13, column=8,
|
||||
def mock_python_ruff():
|
||||
"""Patch PythonRuff inside run_sanity, keeping the real formatting."""
|
||||
real_ruff = PythonRuff()
|
||||
with patch("run_sanity.PythonRuff") as ruff_class:
|
||||
with patch("fiona.run_sanity.PythonRuff") as ruff_class:
|
||||
instance = ruff_class.return_value
|
||||
instance.compress_violations.side_effect = real_ruff.compress_violations
|
||||
instance.format_violations.side_effect = real_ruff.format_violations
|
||||
@@ -373,14 +373,14 @@ class TestRunRuff:
|
||||
|
||||
def test_stdout_lists_file_and_line(self, mock_python_ruff):
|
||||
"""Test stdout names the violating file and the line:column position."""
|
||||
filename = str(run_sanity.SETTINGS_FILE.parent / "run_sanity.py")
|
||||
filename = str(run_sanity.SETTINGS_FILE.parent / "fiona.run_sanity.py")
|
||||
mock_python_ruff.return_value.lint.return_value = [
|
||||
_make_ruff_violation(filename, row=13, column=8, code="F401"),
|
||||
]
|
||||
result = run_sanity.run_ruff()
|
||||
assert result["result"] == 1
|
||||
assert result["violation_count"] == 1
|
||||
assert "run_sanity.py" in result["stdout"]
|
||||
assert "fiona.run_sanity.py" in result["stdout"]
|
||||
assert "13:8 F401" in result["stdout"]
|
||||
|
||||
def test_no_violations_pass(self, mock_python_ruff):
|
||||
@@ -409,7 +409,7 @@ def _make_pyc_violation(filename, line=205, column=4, code="PYC001",
|
||||
def mock_python_custom_linter():
|
||||
"""Patch PythonCustomLinter inside run_sanity, keeping the real formatting."""
|
||||
real_linter = PythonCustomLinter()
|
||||
with patch("run_sanity.PythonCustomLinter") as linter_class:
|
||||
with patch("fiona.run_sanity.PythonCustomLinter") as linter_class:
|
||||
instance = linter_class.return_value
|
||||
instance.compress_violations.side_effect = real_linter.compress_violations
|
||||
instance.format_compressed_violations.side_effect = (
|
||||
@@ -428,7 +428,9 @@ class TestRunPycustomlint:
|
||||
pycustomlint report carries the Violations header, TARGET,
|
||||
DEFINITIONS, FILE, and SUMMARY sections.
|
||||
"""
|
||||
filename = str(run_sanity.SETTINGS_FILE.parent / "customlinter" / "pycustomlint.py")
|
||||
filename = str(
|
||||
pathlib.Path("src/fiona/customlinter/pycustomlint.py").resolve()
|
||||
)
|
||||
mock_python_custom_linter.return_value.lint_directory.return_value = [
|
||||
_make_pyc_violation(filename, line=205, column=4, code="PYC001",
|
||||
message="PYC001 Inline import: import argparse"),
|
||||
@@ -446,7 +448,7 @@ class TestRunPycustomlint:
|
||||
" first function or class is allowed"
|
||||
) in stdout
|
||||
# File path is relative to target (src)
|
||||
assert "- FILE: customlinter/pycustomlint.py" in stdout
|
||||
assert "- FILE: fiona/customlinter/pycustomlint.py" in stdout
|
||||
assert " - PYC001 Inline import: import argparse" in stdout
|
||||
assert "- SUMMARY:" in stdout
|
||||
# file count first, matching the fmlint and markdownlint reports
|
||||
@@ -511,7 +513,7 @@ class TestMain:
|
||||
},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert out.index("AI-FORMATTED-VIOLATIONS") < out.index("Results:")
|
||||
@@ -527,7 +529,7 @@ class TestMain:
|
||||
"stdout": "AI-RUFF-REPORT",
|
||||
},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert out.index("AI-RUFF-REPORT") < out.index("Results:")
|
||||
@@ -542,7 +544,7 @@ class TestMain:
|
||||
"stdout": "AI-PYCUSTOMLINT-REPORT",
|
||||
},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert out.index("AI-PYCUSTOMLINT-REPORT") < out.index("Results:")
|
||||
@@ -562,7 +564,7 @@ class TestMain:
|
||||
"stdout": "AI-PYTESTS-REPORT",
|
||||
},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert out.index("AI-PYTESTS-REPORT") < out.index("Results:")
|
||||
@@ -582,7 +584,7 @@ class TestMain:
|
||||
"stdout": "AI-PYTESTS-REPORT",
|
||||
},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert "AI-PYTESTS-REPORT" in out
|
||||
@@ -598,7 +600,7 @@ class TestMain:
|
||||
},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert "SUMMARY" not in out
|
||||
@@ -727,7 +729,7 @@ class TestFormatCheckSummary:
|
||||
},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert " markdownlint: FAIL - 2 violations" in out
|
||||
@@ -742,16 +744,16 @@ class TestRunAllFunction:
|
||||
|
||||
def test_run_all_runs_all_checks(self, capsys):
|
||||
"""Test run_all executes all six checks and returns their results."""
|
||||
with patch("run_sanity.run_pytests", return_value={"result": 0}) as mock_p, \
|
||||
patch("run_sanity.run_markdownlint",
|
||||
with patch("fiona.run_sanity.run_pytests", return_value={"result": 0}) as mock_p, \
|
||||
patch("fiona.run_sanity.run_markdownlint",
|
||||
return_value={"result": 0, "violation_count": 0}) as mock_m, \
|
||||
patch("run_sanity.run_ruff",
|
||||
patch("fiona.run_sanity.run_ruff",
|
||||
return_value={"result": 0, "violation_count": 0}) as mock_r, \
|
||||
patch("run_sanity.run_frontmatter_lint",
|
||||
patch("fiona.run_sanity.run_frontmatter_lint",
|
||||
return_value={"result": 0, "violation_count": 0}) as mock_f, \
|
||||
patch("run_sanity.run_pycustomlint",
|
||||
patch("fiona.run_sanity.run_pycustomlint",
|
||||
return_value={"result": 0, "violation_count": 0}) as mock_c, \
|
||||
patch("run_sanity.run_jsonlint",
|
||||
patch("fiona.run_sanity.run_jsonlint",
|
||||
return_value={"result": 0, "violation_count": 0}) as mock_j:
|
||||
results = run_sanity.run_all()
|
||||
|
||||
@@ -768,14 +770,14 @@ class TestRunAllFunction:
|
||||
|
||||
def test_run_all_records_durations(self, capsys):
|
||||
"""Test run_all attaches a duration to every check result."""
|
||||
with patch("run_sanity.run_pytests", return_value={"result": 0}), \
|
||||
patch("run_sanity.run_markdownlint",
|
||||
with patch("fiona.run_sanity.run_pytests", return_value={"result": 0}), \
|
||||
patch("fiona.run_sanity.run_markdownlint",
|
||||
return_value={"result": 0, "violation_count": 0}), \
|
||||
patch("run_sanity.run_ruff",
|
||||
patch("fiona.run_sanity.run_ruff",
|
||||
return_value={"result": 0, "violation_count": 0}), \
|
||||
patch("run_sanity.run_frontmatter_lint",
|
||||
patch("fiona.run_sanity.run_frontmatter_lint",
|
||||
return_value={"result": 0, "violation_count": 0}), \
|
||||
patch("run_sanity.run_pycustomlint",
|
||||
patch("fiona.run_sanity.run_pycustomlint",
|
||||
return_value={"result": 0, "violation_count": 0}):
|
||||
results = run_sanity.run_all()
|
||||
|
||||
@@ -793,7 +795,7 @@ class TestVerdict:
|
||||
"markdownlint": {"result": 0, "violation_count": 0},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert "SANITY PASSED" in out
|
||||
@@ -807,7 +809,7 @@ class TestVerdict:
|
||||
"markdownlint": {"result": 0, "violation_count": 0},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert re.search(r"SANITY PASSED \(\d{2}:\d{2}\)", out)
|
||||
@@ -830,7 +832,7 @@ class TestVerdict:
|
||||
"duration_seconds": 7,
|
||||
},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert " pytests: PASS - 0 tests failed (00:42)" in out
|
||||
@@ -851,7 +853,7 @@ class TestVerdict:
|
||||
},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert "Sanity Failed - 1 check needs attention:" in out
|
||||
@@ -865,7 +867,7 @@ class TestVerdict:
|
||||
"markdownlint": {"result": 1, "violation_count": 12},
|
||||
"ruff": {"result": 1, "violation_count": 3},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert "Sanity Failed - 2 checks need attention:" in out
|
||||
@@ -885,7 +887,7 @@ class TestVerdict:
|
||||
},
|
||||
"ruff": {"result": 0, "violation_count": 0},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert " - pytests: 0 tests failed" in out
|
||||
@@ -904,7 +906,7 @@ class TestVerdict:
|
||||
},
|
||||
"markdownlint": {"result": 1, "violation_count": 2},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert " - pytests: 1 test failed" in out
|
||||
@@ -983,7 +985,7 @@ class TestVerdict:
|
||||
],
|
||||
},
|
||||
}
|
||||
with patch("run_sanity.run_all", return_value=results):
|
||||
with patch("fiona.run_sanity.run_all", return_value=results):
|
||||
run_sanity.main([])
|
||||
out = capsys.readouterr().out
|
||||
assert " - pytests: 1 test failed" in out
|
||||
@@ -1017,7 +1019,7 @@ class TestFailedTestReportIntegration:
|
||||
self.target, verbose, capture_output, with_coverage=False
|
||||
)
|
||||
|
||||
return patch("run_sanity.TestRunner", lambda: TargetedRunner(test_file))
|
||||
return patch("fiona.run_sanity.TestRunner", lambda: TargetedRunner(test_file))
|
||||
|
||||
def test_real_failure_shows_function_and_assert(self, tmp_path):
|
||||
"""Test a real pytest failure nests its name and assert under the file.
|
||||
@@ -1316,7 +1318,7 @@ class TestNonInteractiveMode:
|
||||
|
||||
def test_main_wires_progress_callbacks(self, capsys):
|
||||
"""Test main() passes the display callbacks to run_all."""
|
||||
with patch("run_sanity.run_all", return_value={}) as mock_run_all:
|
||||
with patch("fiona.run_sanity.run_all", return_value={}) as mock_run_all:
|
||||
run_sanity.main([])
|
||||
|
||||
assert mock_run_all.call_args.kwargs["progress"] is not None
|
||||
@@ -6,7 +6,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
import run_tests
|
||||
import fiona.run_tests as run_tests
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -339,7 +339,7 @@ class TestRunPytest:
|
||||
),
|
||||
stderr="",
|
||||
)
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
|
||||
result = test_runner.run_pytest("src/tests", verbose=True,
|
||||
with_coverage=False, capture_output=True)
|
||||
@@ -366,7 +366,7 @@ class TestRunPytest:
|
||||
stdout="========================= 1 error in 0.10s =========================\n",
|
||||
stderr="",
|
||||
)
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
|
||||
result = test_runner.run_pytest("src/tests", verbose=True,
|
||||
with_coverage=False, capture_output=True)
|
||||
@@ -385,7 +385,7 @@ class TestRunPytest:
|
||||
would break the output parsers; the command pins --color=no.
|
||||
"""
|
||||
subprocess_mock = mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=0, stdout="1 passed in 0.10s", stderr=""),
|
||||
)
|
||||
test_runner.run_pytest("src/tests", with_coverage=False, capture_output=True)
|
||||
@@ -411,9 +411,9 @@ class TestRunPytest:
|
||||
),
|
||||
stderr="",
|
||||
)
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
|
||||
with caplog.at_level(logging.WARNING, logger="run_tests"):
|
||||
with caplog.at_level(logging.WARNING, logger="fiona.run_tests"):
|
||||
result = test_runner.run_pytest("src/tests", verbose=True,
|
||||
with_coverage=False, capture_output=True)
|
||||
|
||||
@@ -433,7 +433,7 @@ class TestRunPytest:
|
||||
),
|
||||
stderr="",
|
||||
)
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
|
||||
result = test_runner.run_pytest("src/tests", verbose=True,
|
||||
with_coverage=False, capture_output=True)
|
||||
@@ -475,7 +475,7 @@ class TestRunPytest:
|
||||
),
|
||||
stderr="",
|
||||
)
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
|
||||
result = test_runner.run_pytest("src/tests", verbose=True,
|
||||
with_coverage=False, capture_output=True)
|
||||
@@ -502,7 +502,7 @@ class TestRunPytest:
|
||||
),
|
||||
stderr="",
|
||||
)
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
|
||||
result = test_runner.run_pytest("src/tests", verbose=True,
|
||||
with_coverage=False, capture_output=True)
|
||||
@@ -523,12 +523,12 @@ class TestRunPytest:
|
||||
written["path"] = junit_path
|
||||
return MagicMock(returncode=0, stdout="1 passed in 0.10s", stderr="")
|
||||
|
||||
mocker.patch("run_tests.subprocess.run", side_effect=fake_run)
|
||||
mocker.patch("fiona.run_tests.subprocess.run", side_effect=fake_run)
|
||||
test_runner.run_pytest("src/tests", with_coverage=False, capture_output=True)
|
||||
|
||||
assert not pathlib.Path(written["path"]).exists()
|
||||
|
||||
@patch('run_tests.subprocess.run')
|
||||
@patch('fiona.run_tests.subprocess.run')
|
||||
def test_run_pytest_includes_failed_tests(self, mock_run, test_runner):
|
||||
"""Test run_pytest returns the failed test details."""
|
||||
mock_run.return_value = MagicMock(
|
||||
@@ -544,7 +544,7 @@ class TestRunPytest:
|
||||
assert result["failed_tests"][0]["id"] == "src/tests/test_a.py::TestX::test_one"
|
||||
assert "assert 1 == 2" in result["failed_tests"][0]["message"]
|
||||
|
||||
@patch('run_tests.subprocess.run')
|
||||
@patch('fiona.run_tests.subprocess.run')
|
||||
def test_run_pytest_warns_when_failure_details_missing(self, mock_run, test_runner,
|
||||
caplog):
|
||||
"""Test a warning is logged when failures count but no details parse."""
|
||||
@@ -555,13 +555,13 @@ class TestRunPytest:
|
||||
),
|
||||
stderr=""
|
||||
)
|
||||
with caplog.at_level(logging.WARNING, logger="run_tests"):
|
||||
with caplog.at_level(logging.WARNING, logger="fiona.run_tests"):
|
||||
result = test_runner.run_pytest("src/tests", capture_output=True)
|
||||
assert result["failed_count"] == 1
|
||||
assert result["failed_tests"] == []
|
||||
assert "no failure details" in caplog.text
|
||||
|
||||
@patch('run_tests.subprocess.run')
|
||||
@patch('fiona.run_tests.subprocess.run')
|
||||
def test_run_pytest_includes_file_results(self, mock_run, test_runner):
|
||||
"""Test run_pytest returns per-file results from verbose output."""
|
||||
mock_run.return_value = MagicMock(
|
||||
@@ -578,7 +578,7 @@ class TestRunPytest:
|
||||
assert result["file_results"]["test_a.py"]["passed"] == 2
|
||||
assert result["file_results"]["test_b.py"]["passed"] == 1
|
||||
|
||||
@patch('run_tests.subprocess.run')
|
||||
@patch('fiona.run_tests.subprocess.run')
|
||||
def test_run_pytest_includes_coverage_files(self, mock_run, test_runner):
|
||||
"""Test run_pytest returns per-file coverage from the report."""
|
||||
mock_run.return_value = MagicMock(
|
||||
@@ -594,7 +594,7 @@ class TestRunPytest:
|
||||
result = test_runner.run_pytest("src/tests", capture_output=True)
|
||||
assert result["coverage_files"]["src/wiki/wiki.py"] == 96.0
|
||||
|
||||
@patch('run_tests.subprocess.run')
|
||||
@patch('fiona.run_tests.subprocess.run')
|
||||
def test_run_pytest_records_spawn_errors(self, mock_run, test_runner):
|
||||
"""Test subprocess spawn failures are recorded, not raised."""
|
||||
mock_run.side_effect = OSError("spawn failed")
|
||||
@@ -606,7 +606,7 @@ class TestRunPytest:
|
||||
assert result["exc"] is not None
|
||||
assert test_runner.total_collected == 0
|
||||
|
||||
@patch('run_tests.subprocess.run')
|
||||
@patch('fiona.run_tests.subprocess.run')
|
||||
def test_run_pytest_does_not_swallow_unexpected_errors(self, mock_run, test_runner):
|
||||
"""Test unexpected exceptions propagate instead of being swallowed."""
|
||||
mock_run.side_effect = RuntimeError("unexpected")
|
||||
@@ -614,7 +614,7 @@ class TestRunPytest:
|
||||
with pytest.raises(RuntimeError):
|
||||
test_runner.run_pytest("src/tests", capture_output=True)
|
||||
|
||||
# @patch('run_tests.subprocess.run')
|
||||
# @patch('fiona.run_tests.subprocess.run')
|
||||
# def test_run_pytest_success(self, mock_run, test_runner):
|
||||
# """Test running pytest successfully."""
|
||||
# mock_run.return_value = MagicMock(
|
||||
@@ -634,7 +634,7 @@ class TestRunPytest:
|
||||
# assert test_runner.total_passed == 3
|
||||
# assert test_runner.total_failed == 0
|
||||
|
||||
# @patch('run_tests.subprocess.run')
|
||||
# @patch('fiona.run_tests.subprocess.run')
|
||||
# def test_run_pytest_failure(self, mock_run, test_runner):
|
||||
# """Test running pytest with failures."""
|
||||
# mock_run.return_value = MagicMock(
|
||||
@@ -654,7 +654,7 @@ class TestRunPytest:
|
||||
# assert test_runner.total_passed == 2
|
||||
# assert test_runner.total_failed == 1
|
||||
|
||||
# @patch('run_tests.subprocess.run')
|
||||
# @patch('fiona.run_tests.subprocess.run')
|
||||
# def test_run_pytest_exception(self, mock_run, test_runner):
|
||||
# """Test handling of exceptions in pytest execution."""
|
||||
# mock_run.side_effect = Exception("Test error")
|
||||
@@ -668,7 +668,7 @@ class TestRunPytest:
|
||||
# assert test_runner.total_passed == 0
|
||||
# assert test_runner.total_failed == 0
|
||||
|
||||
# @patch('run_tests.subprocess.run')
|
||||
# @patch('fiona.run_tests.subprocess.run')
|
||||
# def test_run_pytest_verbose(self, mock_run, test_runner):
|
||||
# """Test running pytest in verbose mode."""
|
||||
# mock_run.return_value = MagicMock(
|
||||
@@ -684,7 +684,7 @@ class TestRunPytest:
|
||||
# call_args = mock_run.call_args[0][0]
|
||||
# assert "-v" in call_args
|
||||
|
||||
# @patch('run_tests.subprocess.run')
|
||||
# @patch('fiona.run_tests.subprocess.run')
|
||||
# def test_run_pytest_capture_output(self, mock_run, test_runner):
|
||||
# """Test running pytest with output capture."""
|
||||
# mock_run.return_value = MagicMock(
|
||||
@@ -701,7 +701,7 @@ class TestRunPytest:
|
||||
def test_called_with_verbose_flag(self, mocker, test_runner):
|
||||
"""Test that the pytest subprocess command includes the verbose flag."""
|
||||
subprocess_mock = mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=0, stdout="1 passed in 0.10s", stderr=""),
|
||||
)
|
||||
result = test_runner.run_pytest("src/tests", verbose=True, with_coverage=False)
|
||||
@@ -713,7 +713,7 @@ class TestRunPytest:
|
||||
def test_prints_output_when_not_captured(self, mocker, test_runner, capsys):
|
||||
"""Test that subprocess output is printed when capture is disabled."""
|
||||
mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=0, stdout="test output", stderr=""),
|
||||
)
|
||||
test_runner.run_pytest("src/tests", with_coverage=False, capture_output=False)
|
||||
@@ -722,7 +722,7 @@ class TestRunPytest:
|
||||
def test_suppresses_output_when_captured(self, mocker, test_runner, capsys):
|
||||
"""Test that subprocess output is suppressed when capture is enabled."""
|
||||
mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=0, stdout="test output", stderr=""),
|
||||
)
|
||||
test_runner.run_pytest("src/tests", with_coverage=False, capture_output=True)
|
||||
@@ -732,7 +732,7 @@ class TestRunPytest:
|
||||
"""Test that a covered run records the coverage percentage from output."""
|
||||
stdout = "TOTAL 729 98 87%\n3 passed in 0.10s"
|
||||
mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=0, stdout=stdout, stderr=""),
|
||||
)
|
||||
result = test_runner.run_pytest("src/tests", with_coverage=True)
|
||||
@@ -742,7 +742,7 @@ class TestRunPytest:
|
||||
def test_coverage_percent_none_without_coverage(self, mocker, test_runner):
|
||||
"""Test that coverage percentage stays None when coverage is disabled."""
|
||||
mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=0, stdout="1 passed in 0.10s", stderr=""),
|
||||
)
|
||||
result = test_runner.run_pytest("src/tests", with_coverage=False)
|
||||
@@ -752,7 +752,7 @@ class TestRunPytest:
|
||||
"""Test that test counts are parsed from the subprocess output."""
|
||||
stdout = "2 failed, 3 passed, 1 skipped in 0.10s"
|
||||
mocker.patch(
|
||||
"run_tests.subprocess.run",
|
||||
"fiona.run_tests.subprocess.run",
|
||||
return_value=MagicMock(returncode=1, stdout=stdout, stderr=""),
|
||||
)
|
||||
result = test_runner.run_pytest("src/tests", with_coverage=False)
|
||||
@@ -780,7 +780,7 @@ class TestRunAllTests:
|
||||
all_passed = test_runner.run_all_tests(verbose=False, capture_output=False, with_coverage=True)
|
||||
|
||||
assert all_passed is True
|
||||
mock_run_pytest.assert_called_once_with("src/tests", False, False, True)
|
||||
mock_run_pytest.assert_called_once_with("tests", False, False, True)
|
||||
|
||||
@patch.object(run_tests.TestRunner, 'run_pytest')
|
||||
def test_run_all_tests_failure(self, mock_run_pytest, test_runner):
|
||||
@@ -864,8 +864,8 @@ class TestParseCoverageOutput:
|
||||
class TestRunTestsMain:
|
||||
"""Tests for run_tests.run_tests.main() function."""
|
||||
|
||||
@patch('run_tests.TestRunner')
|
||||
@patch('run_tests.argparse')
|
||||
@patch('fiona.run_tests.TestRunner')
|
||||
@patch('fiona.run_tests.argparse')
|
||||
def test_main_all_tests_pass(self, mock_argparse, mock_runner_class):
|
||||
"""Test run_tests.main() when all tests pass."""
|
||||
mock_runner = MagicMock()
|
||||
@@ -896,8 +896,8 @@ class TestRunTestsMain:
|
||||
False, False, True
|
||||
)
|
||||
|
||||
@patch('run_tests.TestRunner')
|
||||
@patch('run_tests.argparse')
|
||||
@patch('fiona.run_tests.TestRunner')
|
||||
@patch('fiona.run_tests.argparse')
|
||||
def test_main_verbose_mode(self, mock_argparse, mock_runner_class):
|
||||
"""Test run_tests.main() in verbose mode."""
|
||||
mock_runner = MagicMock()
|
||||
@@ -928,8 +928,8 @@ class TestRunTestsMain:
|
||||
True, False, True
|
||||
)
|
||||
|
||||
@patch('run_tests.TestRunner')
|
||||
@patch('run_tests.argparse')
|
||||
@patch('fiona.run_tests.TestRunner')
|
||||
@patch('fiona.run_tests.argparse')
|
||||
def test_main_ci_mode(self, mock_argparse, mock_runner_class):
|
||||
"""Test run_tests.main() in CI mode."""
|
||||
mock_runner = MagicMock()
|
||||
@@ -960,8 +960,8 @@ class TestRunTestsMain:
|
||||
False, True, True
|
||||
)
|
||||
|
||||
@patch('run_tests.TestRunner')
|
||||
@patch('run_tests.argparse')
|
||||
@patch('fiona.run_tests.TestRunner')
|
||||
@patch('fiona.run_tests.argparse')
|
||||
def test_main_skip_coverage(self, mock_argparse, mock_runner_class):
|
||||
"""Test run_tests.main() with --skip-cov flag."""
|
||||
mock_runner = MagicMock()
|
||||
@@ -992,9 +992,9 @@ class TestRunTestsMain:
|
||||
False, False, False
|
||||
)
|
||||
|
||||
@patch('run_tests.TestRunner')
|
||||
@patch('run_tests.argparse')
|
||||
@patch('run_tests.sys')
|
||||
@patch('fiona.run_tests.TestRunner')
|
||||
@patch('fiona.run_tests.argparse')
|
||||
@patch('fiona.run_tests.sys')
|
||||
def test_main_specific_test(self, mock_sys, mock_argparse, mock_runner_class):
|
||||
"""Test run_tests.main() with a specific test path."""
|
||||
mock_runner = MagicMock()
|
||||
@@ -1034,8 +1034,8 @@ class TestRunTestsMain:
|
||||
'src/tests/test_librarian.py', False, False, True
|
||||
)
|
||||
|
||||
@patch('run_tests.TestRunner')
|
||||
@patch('run_tests.argparse')
|
||||
@patch('fiona.run_tests.TestRunner')
|
||||
@patch('fiona.run_tests.argparse')
|
||||
def test_main_tests_fail(self, mock_argparse, mock_runner_class):
|
||||
"""Test run_tests.main() when tests fail."""
|
||||
mock_runner = MagicMock()
|
||||
@@ -12,9 +12,9 @@ import re
|
||||
|
||||
import pytest
|
||||
|
||||
import run_sanity
|
||||
from wiki import sanity_manager
|
||||
from wiki.sanity_manager import (
|
||||
import fiona.run_sanity as run_sanity
|
||||
from fiona.wiki import sanity_manager
|
||||
from fiona.wiki.sanity_manager import (
|
||||
SANITY_CHECKS,
|
||||
format_sanity_report,
|
||||
run_wiki_checks,
|
||||
@@ -11,7 +11,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
import time
|
||||
|
||||
from sanity_runner import SanityRunner, format_duration
|
||||
from fiona.sanity_runner import SanityRunner, format_duration
|
||||
|
||||
# =============================================================================
|
||||
# Execution Tests
|
||||
@@ -117,7 +117,7 @@ class TestRunAllCallbacks:
|
||||
def test_lifecycle_logged_at_info(self, caplog):
|
||||
runner = SanityRunner(checks=[("a", lambda: {"result": 0})])
|
||||
|
||||
with caplog.at_level(logging.INFO, logger="sanity_runner.sanity_runner"):
|
||||
with caplog.at_level(logging.INFO, logger="fiona.sanity_runner.sanity_runner"):
|
||||
runner.run_all()
|
||||
|
||||
messages = [record.message for record in caplog.records]
|
||||
@@ -13,8 +13,8 @@ import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from librarian import toc_generator
|
||||
from librarian.toc_generator import (
|
||||
from fiona.librarian import toc_generator
|
||||
from fiona.librarian.toc_generator import (
|
||||
FILE_TOC_END,
|
||||
FILE_TOC_START,
|
||||
TOC_NAME,
|
||||
@@ -1434,7 +1434,7 @@ class TestFolderTocValidation:
|
||||
original_argv = sys.argv
|
||||
try:
|
||||
monkeypatch.setenv("LOG_LEVEL", "DEBUG")
|
||||
with caplog.at_level(logging.DEBUG, logger="librarian"):
|
||||
with caplog.at_level(logging.DEBUG, logger="fiona.librarian"):
|
||||
sys.argv = ["toc_generator", str(tmp_path)]
|
||||
main()
|
||||
finally:
|
||||
@@ -1454,7 +1454,7 @@ class TestFileTocLogging:
|
||||
original_argv = sys.argv
|
||||
try:
|
||||
monkeypatch.setenv("LOG_LEVEL", "DEBUG")
|
||||
with caplog.at_level(logging.DEBUG, logger="librarian"):
|
||||
with caplog.at_level(logging.DEBUG, logger="fiona.librarian"):
|
||||
sys.argv = ["toc_generator", "file", str(doc)]
|
||||
main()
|
||||
finally:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user