From 02acc2407d1ed59330044e3006e2497497e31c4c Mon Sep 17 00:00:00 2001 From: Jimisola Laursen Date: Mon, 2 Mar 2026 20:11:02 +0100 Subject: [PATCH 1/4] chore: add .claude/ to .gitignore Prevent Claude Code settings from being accidentally committed. --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bfa28bc..9a1fb29 100644 --- a/.gitignore +++ b/.gitignore @@ -216,4 +216,6 @@ poetry.toml # LSP config files pyrightconfig.json -# End of https://www.toptal.com/developers/gitignore/api/java,maven,python \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/java,maven,python +# Claude Code +.claude/ From 35eb1911460751ee4ec6873ad3686ed6dc8d8af6 Mon Sep 17 00:00:00 2001 From: Jimisola Laursen Date: Mon, 2 Mar 2026 21:38:04 +0100 Subject: [PATCH 2/4] chore: generate .gitignore from toptal templates with custom additions --- .gitignore | 147 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 106 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 9a1fb29..f0277f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,50 +1,93 @@ -# Created by https://www.toptal.com/developers/gitignore/api/java,maven,python -# Edit at https://www.toptal.com/developers/gitignore?templates=java,maven,python +# Created by https://www.toptal.com/developers/gitignore/api/python,intellij+all,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=python,intellij+all,visualstudiocode -### Java ### -# Compiled class file -*.class +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 -# Log file -*.log +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf -# BlueJ files -*.ctxt +# AWS User-specific +.idea/**/aws.xml -# Mobile Tools for Java (J2ME) -.mtj.tmp/ +# Generated files +.idea/**/contentModel.xml -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -replay_pid* +# Gradle +.idea/**/gradle.xml +.idea/**/libraries -### Maven ### -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar -.mvn/wrapper/maven-wrapper.jar - -# Eclipse m2e generated files -# Eclipse Core -.project -# JDT-specific (Eclipse Java Development Tools) -.classpath +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations ### Python ### # Byte-compiled / optimized / DLL files @@ -105,6 +148,7 @@ cover/ *.pot # Django stuff: +*.log local_settings.py db.sqlite3 db.sqlite3-journal @@ -121,6 +165,7 @@ docs/_build/ # PyBuilder .pybuilder/ +target/ # Jupyter Notebook .ipynb_checkpoints @@ -216,6 +261,26 @@ poetry.toml # LSP config files pyrightconfig.json -# End of https://www.toptal.com/developers/gitignore/api/java,maven,python +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/python,intellij+all,visualstudiocode + # Claude Code .claude/ From a5b94856e84a0057a151e4ff776389d75dda8515 Mon Sep 17 00:00:00 2001 From: Jimisola Laursen Date: Tue, 3 Mar 2026 19:50:53 +0100 Subject: [PATCH 3/4] docs(fixtures): add SVCs, test file, pytest junit config, reqstool status instructions --- tests/fixtures/test_project/README.md | 43 ++++++++++++++----- .../docs/reqstool/requirements.yml | 10 +++-- .../reqstool/software_verification_cases.yml | 8 ++++ tests/fixtures/test_project/pyproject.toml | 10 +++++ .../fixtures/test_project/tests/test_main.py | 8 ++++ 5 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 tests/fixtures/test_project/docs/reqstool/software_verification_cases.yml create mode 100644 tests/fixtures/test_project/tests/test_main.py diff --git a/tests/fixtures/test_project/README.md b/tests/fixtures/test_project/README.md index b6554e6..c330baa 100644 --- a/tests/fixtures/test_project/README.md +++ b/tests/fixtures/test_project/README.md @@ -5,12 +5,12 @@ Minimal test project for manual validation of `reqstool-python-poetry-plugin`. ## Prerequisites A `.venv` must exist in the repository root with both the plugin and Poetry installed. -If it is missing, recreate it from the repository root: +If it is missing, recreate it from the repository root (`reqstool-python-poetry-plugin/`): ```bash python3.13 -m venv .venv .venv/bin/pip install -e . -.venv/bin/pip install poetry +.venv/bin/pip install poetry reqstool ``` Point Poetry at Python 3.13 (once per machine): @@ -24,7 +24,7 @@ cd tests/fixtures/test_project Run all commands from `tests/fixtures/test_project/`. -### 1 — Install +### 1 — Install (adds `include` entries to pyproject.toml) ```bash ../../../.venv/bin/poetry install @@ -36,7 +36,15 @@ Expected: plugin prints its version, then adds three entries to `pyproject.toml` include = ["reqstool_config.yml", "docs/reqstool/**/*", "build/reqstool/**/*"] ``` -### 2 — Build +### 2 — Run tests + +```bash +../../../.venv/bin/pytest tests/ --junit-xml=build/test-results/junit.xml -v +``` + +Expected: `test_hello` passes. + +### 3 — Build ```bash ../../../.venv/bin/poetry build @@ -45,18 +53,19 @@ include = ["reqstool_config.yml", "docs/reqstool/**/*", "build/reqstool/**/*"] Expected output (in order): 1. `[reqstool] plugin version ` 2. `[reqstool] added to reqstool_config.yml: docs/reqstool/requirements.yml` -3. `[reqstool] added to reqstool_config.yml: build/reqstool/annotations.yml` -4. `[reqstool] Created reqstool_config.yml in project root` -5. Poetry builds sdist + wheel -6. `[reqstool] Removed reqstool_config.yml from project root` +3. `[reqstool] added to reqstool_config.yml: docs/reqstool/software_verification_cases.yml` +4. `[reqstool] added to reqstool_config.yml: build/reqstool/annotations.yml` +5. `[reqstool] Created reqstool_config.yml in project root` +6. Poetry builds sdist + wheel +7. `[reqstool] Removed reqstool_config.yml from project root` -### 3 — Verify +### 4 — Check artefacts ```bash # annotations.yml must exist test -f build/reqstool/annotations.yml && echo "OK: annotations.yml" -# reqstool_config.yml must be gone from project root after build +# reqstool_config.yml must be gone after build test ! -f reqstool_config.yml && echo "OK: reqstool_config.yml cleaned up" # sdist must contain all reqstool files @@ -67,5 +76,17 @@ Expected entries in the sdist: - `mypackage-0.1.0/reqstool_config.yml` - `mypackage-0.1.0/build/reqstool/annotations.yml` - `mypackage-0.1.0/docs/reqstool/requirements.yml` +- `mypackage-0.1.0/docs/reqstool/software_verification_cases.yml` + +### 5 — Run reqstool status + +Extract the sdist and merge in the local test results, then run `reqstool status`: + +```bash +mkdir -p /tmp/mypackage-reqstool +tar -xzf dist/mypackage-0.1.0.tar.gz -C /tmp/mypackage-reqstool +cp -r build/test-results /tmp/mypackage-reqstool/mypackage-0.1.0/build/ +../../../.venv/bin/reqstool status local -p /tmp/mypackage-reqstool/mypackage-0.1.0 +``` -`annotations.yml` must contain `REQ_001` mapped to `src.mypackage.main.hello`. +Expected: all green — `REQ_001` implemented, `T1 P1`, no missing tests or SVCs. diff --git a/tests/fixtures/test_project/docs/reqstool/requirements.yml b/tests/fixtures/test_project/docs/reqstool/requirements.yml index 5040328..91bb93d 100644 --- a/tests/fixtures/test_project/docs/reqstool/requirements.yml +++ b/tests/fixtures/test_project/docs/reqstool/requirements.yml @@ -1,5 +1,8 @@ -document: - id: mypackage +# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/requirements.schema.json + +metadata: + urn: mypackage + variant: microservice title: Mypackage Requirements url: https://github.com/reqstool/reqstool-python-poetry-plugin @@ -8,6 +11,5 @@ requirements: title: Hello function significance: shall description: The hello function shall return "hello". - categories: - - category: functional + categories: ["functional-suitability"] revision: "0.1.0" diff --git a/tests/fixtures/test_project/docs/reqstool/software_verification_cases.yml b/tests/fixtures/test_project/docs/reqstool/software_verification_cases.yml new file mode 100644 index 0000000..da083ba --- /dev/null +++ b/tests/fixtures/test_project/docs/reqstool/software_verification_cases.yml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/software_verification_cases.schema.json + +cases: + - id: SVC_001 + requirement_ids: ["REQ_001"] + title: "Hello function returns hello" + verification: automated-test + revision: "0.1.0" diff --git a/tests/fixtures/test_project/pyproject.toml b/tests/fixtures/test_project/pyproject.toml index 151931c..82f0bf9 100644 --- a/tests/fixtures/test_project/pyproject.toml +++ b/tests/fixtures/test_project/pyproject.toml @@ -17,6 +17,16 @@ include = ["reqstool_config.yml", "docs/reqstool/**/*", "build/reqstool/**/*"] [tool.poetry.dependencies] python = "^3.13" +[tool.poetry.group.dev.dependencies] +pytest = "*" +pytest-cov = "*" + +[tool.pytest.ini_options] +addopts = ["--import-mode=importlib"] +pythonpath = ["src"] +testpaths = ["tests"] +junit_family = "xunit2" + [tool.reqstool] sources = ["src", "tests"] test_results = ["build/**/junit.xml"] diff --git a/tests/fixtures/test_project/tests/test_main.py b/tests/fixtures/test_project/tests/test_main.py new file mode 100644 index 0000000..72e7562 --- /dev/null +++ b/tests/fixtures/test_project/tests/test_main.py @@ -0,0 +1,8 @@ +from reqstool_python_decorators.decorators.decorators import SVCs + +from mypackage.main import hello + + +@SVCs("SVC_001") +def test_hello(): + assert hello() == "hello" From 86bc4ec536079dd6c0a77a639eefd8d7646483d3 Mon Sep 17 00:00:00 2001 From: Jimisola Laursen Date: Tue, 3 Mar 2026 20:26:16 +0100 Subject: [PATCH 4/4] test(fixtures): exclude fixtures from root pytest collection --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 033992c..15d1075 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ addopts = [ ] pythonpath = [".", "src", "tests"] testpaths = ["tests"] +norecursedirs = ["tests/fixtures"] markers = [ "flaky: tests that can randomly fail through no change to the code", "slow: marks tests as slow (deselect with '-m \"not slow\"')",