spec-test 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. spec_test-0.1.4/.gitignore +3 -0
  2. {spec_test-0.1.2 → spec_test-0.1.4}/PKG-INFO +1 -1
  3. spec_test-0.1.4/agent.md +200 -0
  4. {spec_test-0.1.2 → spec_test-0.1.4}/docs/specs/spec-spec-test.md +9 -0
  5. {spec_test-0.1.2 → spec_test-0.1.4}/pyproject.toml +6 -1
  6. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/decorators.py +38 -13
  7. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/runner.py +35 -18
  8. spec_test-0.1.4/tests/test_decorators.py +135 -0
  9. spec_test-0.1.4/tests/test_runner.py +72 -0
  10. {spec_test-0.1.2 → spec_test-0.1.4}/uv.lock +22 -1
  11. spec_test-0.1.2/.gitignore +0 -1
  12. spec_test-0.1.2/tests/test_decorators.py +0 -72
  13. {spec_test-0.1.2 → spec_test-0.1.4}/.github/workflows/publish.yml +0 -0
  14. {spec_test-0.1.2 → spec_test-0.1.4}/CLAUDE.md +0 -0
  15. {spec_test-0.1.2 → spec_test-0.1.4}/README.md +0 -0
  16. {spec_test-0.1.2 → spec_test-0.1.4}/prompt.md +0 -0
  17. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/__init__.py +0 -0
  18. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/cli.py +0 -0
  19. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/collector.py +0 -0
  20. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/pytest_plugin.py +0 -0
  21. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/reporter.py +0 -0
  22. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/types.py +0 -0
  23. {spec_test-0.1.2 → spec_test-0.1.4}/spec_test/verifier.py +0 -0
  24. {spec_test-0.1.2 → spec_test-0.1.4}/tests/__init__.py +0 -0
  25. {spec_test-0.1.2 → spec_test-0.1.4}/tests/conftest.py +0 -0
  26. {spec_test-0.1.2 → spec_test-0.1.4}/tests/test_cli.py +0 -0
  27. {spec_test-0.1.2 → spec_test-0.1.4}/tests/test_collector.py +0 -0
  28. {spec_test-0.1.2 → spec_test-0.1.4}/tests/test_reporter.py +0 -0
  29. {spec_test-0.1.2 → spec_test-0.1.4}/tests/test_verifier.py +0 -0
@@ -0,0 +1,3 @@
1
+ dist/
2
+ __pycache__/
3
+ *.pyc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spec-test
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Specification-driven development tool with test verification
5
5
  Author: Pulse Team
6
6
  License: MIT
@@ -0,0 +1,200 @@
1
+ # AI Agent Workflow for spec-test
2
+
3
+ This document describes how AI agents should work on issues in this repository.
4
+
5
+ ## Trigger
6
+
7
+ Issues labeled `ai-agent` are candidates for automated AI agent work.
8
+
9
+ ## Workflow Steps
10
+
11
+ ### 1. Fetch the Issue
12
+
13
+ ```bash
14
+ gh issue view <issue-number>
15
+ ```
16
+
17
+ Or list available issues:
18
+
19
+ ```bash
20
+ gh issue list --label ai-agent
21
+ ```
22
+
23
+ ### 2. Understand the Problem
24
+
25
+ - Read the issue description carefully
26
+ - Identify what behavior is broken or missing
27
+ - Check if there's a related spec in `docs/specs/*.md`
28
+
29
+ ### 3. Reproduce the Issue (if applicable)
30
+
31
+ Before fixing, confirm the issue exists:
32
+
33
+ ```bash
34
+ # Build and install the package
35
+ uv build
36
+ uv venv --seed
37
+ .venv/bin/pip install dist/*.whl
38
+
39
+ # Run tests to see current state
40
+ .venv/bin/pytest
41
+
42
+ # Run spec verification
43
+ .venv/bin/spec-test verify
44
+ ```
45
+
46
+ ### 4. Add or Update Specs
47
+
48
+ If the fix requires new behavior:
49
+
50
+ 1. Add a spec to the appropriate file in `docs/specs/*.md`:
51
+ ```markdown
52
+ - **PREFIX-NNN**: Description of the requirement
53
+ ```
54
+
55
+ 2. Use meaningful prefixes:
56
+ - `DEC-` for decorator functionality
57
+ - `CLI-` for CLI commands
58
+ - `RUN-` for runner/discovery logic
59
+ - `PARSE-` for spec parsing
60
+
61
+ ### 5. Write Tests First
62
+
63
+ Create or update tests in `tests/`:
64
+
65
+ ```python
66
+ from spec_test import spec
67
+
68
+ @spec("PREFIX-NNN", "Description matching the spec")
69
+ def test_the_new_behavior():
70
+ # Implement the test
71
+ assert actual == expected
72
+ ```
73
+
74
+ For async tests:
75
+
76
+ ```python
77
+ import pytest
78
+ from spec_test import spec
79
+
80
+ @spec("PREFIX-NNN", "Async behavior description")
81
+ @pytest.mark.asyncio
82
+ async def test_async_behavior():
83
+ result = await some_async_function()
84
+ assert result == expected
85
+ ```
86
+
87
+ For class-based tests:
88
+
89
+ ```python
90
+ from spec_test import spec
91
+
92
+ class TestFeature:
93
+ @spec("PREFIX-NNN", "Class method test description")
94
+ def test_feature_behavior(self):
95
+ assert True
96
+ ```
97
+
98
+ ### 6. Implement the Fix
99
+
100
+ - Make minimal changes to fix the issue
101
+ - Follow existing code patterns
102
+ - Don't over-engineer or add unnecessary features
103
+
104
+ Key source files:
105
+ - `src/spec_test/decorators.py` - @spec and @specs decorators
106
+ - `src/spec_test/runner.py` - Test discovery and execution
107
+ - `src/spec_test/parser.py` - Spec file parsing
108
+ - `src/spec_test/cli.py` - CLI commands
109
+
110
+ ### 7. Verify the Fix
111
+
112
+ ```bash
113
+ # Rebuild
114
+ uv build
115
+
116
+ # Reinstall
117
+ .venv/bin/pip install dist/*.whl --force-reinstall
118
+
119
+ # Run all tests
120
+ .venv/bin/pytest
121
+
122
+ # Verify all specs have passing tests
123
+ .venv/bin/spec-test verify
124
+ ```
125
+
126
+ All specs must show 100% coverage before committing.
127
+
128
+ ### 8. Commit the Changes
129
+
130
+ Write a clear commit message:
131
+
132
+ ```bash
133
+ git add -A
134
+ git commit -m "fix: brief description of the fix
135
+
136
+ - What was broken
137
+ - How it was fixed
138
+ - Related specs added/updated
139
+
140
+ Fixes #<issue-number>"
141
+ ```
142
+
143
+ ### 9. Comment on the Issue
144
+
145
+ Add a comment explaining:
146
+ - Root cause of the issue
147
+ - What changes were made
148
+ - Which files were modified
149
+ - New specs/tests added
150
+
151
+ ```bash
152
+ gh issue comment <issue-number> --body "..."
153
+ ```
154
+
155
+ ### 10. Close the Issue
156
+
157
+ ```bash
158
+ gh issue close <issue-number>
159
+ ```
160
+
161
+ ## Important Rules
162
+
163
+ 1. **Never skip testing** - Always run tests before committing
164
+ 2. **Don't bump version unnecessarily** - Only bump for releases
165
+ 3. **Spec-first development** - Add specs before or with your fix
166
+ 4. **100% spec coverage required** - `spec-test verify` must pass
167
+ 5. **Minimal changes** - Fix the issue, don't refactor unrelated code
168
+
169
+ ## Python Version Notes
170
+
171
+ This project requires Python 3.11+ due to type syntax (`str | Path`).
172
+
173
+ Use `uv` to manage Python versions:
174
+
175
+ ```bash
176
+ uv venv --python 3.13 --seed
177
+ ```
178
+
179
+ ## Common Issues
180
+
181
+ ### Module not found after install
182
+
183
+ Reinstall from wheel:
184
+ ```bash
185
+ .venv/bin/pip install dist/*.whl --force-reinstall
186
+ ```
187
+
188
+ ### Tests pass but spec-test verify fails
189
+
190
+ Check that:
191
+ - Your test has `@spec("ID", "description")` decorator
192
+ - The spec ID exists in `docs/specs/*.md`
193
+ - The test function name starts with `test_`
194
+
195
+ ### Async tests not discovered
196
+
197
+ Ensure both:
198
+ - `@pytest.mark.asyncio` decorator is present
199
+ - `@spec()` decorator is present
200
+ - Function is defined with `async def`
@@ -10,6 +10,9 @@ spec-test is a tool for specification-driven development that links requirements
10
10
  - **DEC-002**: @spec decorator adds pytest marker to test
11
11
  - **DEC-003**: @spec decorator preserves function metadata
12
12
  - **DEC-004**: @specs decorator supports multiple spec IDs
13
+ - **DEC-005**: @spec decorator preserves async function behavior
14
+ - **DEC-006**: @spec decorator works regardless of decorator order with pytest.mark.asyncio
15
+ - **DEC-007**: @specs decorator preserves async function behavior
13
16
 
14
17
  ## Collector Requirements
15
18
 
@@ -19,6 +22,12 @@ spec-test is a tool for specification-driven development that links requirements
19
22
  - **COL-003**: Collector handles nested directories
20
23
  - **COL-004**: Collector only processes files matching spec-*.md pattern
21
24
 
25
+ ## Runner Requirements
26
+
27
+ ### Test Discovery
28
+ - **RUN-001**: Runner discovers @spec decorated methods inside test classes
29
+ - **RUN-002**: Runner generates correct pytest node ID for class-based tests
30
+
22
31
  ## Verifier Requirements
23
32
 
24
33
  ### Verification
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spec-test"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Specification-driven development tool with test verification"
5
5
  authors = [{ name = "Pulse Team" }]
6
6
  readme = "README.md"
@@ -43,3 +43,8 @@ target-version = "py311"
43
43
  [tool.mypy]
44
44
  python_version = "3.11"
45
45
  strict = true
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "pytest-asyncio>=1.3.0",
50
+ ]
@@ -1,5 +1,6 @@
1
1
  """Decorators for linking tests to specifications."""
2
2
 
3
+ import asyncio
3
4
  import functools
4
5
  from typing import Callable, Optional
5
6
 
@@ -50,16 +51,29 @@ def spec(
50
51
  marked = pytest.mark.spec(func)
51
52
  marked = pytest.mark.spec_id(spec_id)(marked)
52
53
 
53
- @functools.wraps(func)
54
- def wrapper(*args, **kwargs):
55
- return func(*args, **kwargs)
54
+ # Create appropriate wrapper based on whether func is async
55
+ if asyncio.iscoroutinefunction(func):
56
56
 
57
- # Preserve spec metadata on wrapper
58
- wrapper._spec_id = spec_id
59
- wrapper._spec_description = description
60
- wrapper._spec_notes = verification_notes
57
+ @functools.wraps(func)
58
+ async def async_wrapper(*args, **kwargs):
59
+ return await func(*args, **kwargs)
61
60
 
62
- return wrapper
61
+ # Preserve spec metadata on wrapper
62
+ async_wrapper._spec_id = spec_id
63
+ async_wrapper._spec_description = description
64
+ async_wrapper._spec_notes = verification_notes
65
+ return async_wrapper
66
+ else:
67
+
68
+ @functools.wraps(func)
69
+ def wrapper(*args, **kwargs):
70
+ return func(*args, **kwargs)
71
+
72
+ # Preserve spec metadata on wrapper
73
+ wrapper._spec_id = spec_id
74
+ wrapper._spec_description = description
75
+ wrapper._spec_notes = verification_notes
76
+ return wrapper
63
77
 
64
78
  return decorator
65
79
 
@@ -103,11 +117,22 @@ def specs(*spec_ids: str):
103
117
  for sid in spec_ids:
104
118
  marked = pytest.mark.spec_id(sid)(marked)
105
119
 
106
- @functools.wraps(func)
107
- def wrapper(*args, **kwargs):
108
- return func(*args, **kwargs)
120
+ # Create appropriate wrapper based on whether func is async
121
+ if asyncio.iscoroutinefunction(func):
122
+
123
+ @functools.wraps(func)
124
+ async def async_wrapper(*args, **kwargs):
125
+ return await func(*args, **kwargs)
126
+
127
+ async_wrapper._spec_ids = spec_ids
128
+ return async_wrapper
129
+ else:
130
+
131
+ @functools.wraps(func)
132
+ def wrapper(*args, **kwargs):
133
+ return func(*args, **kwargs)
109
134
 
110
- wrapper._spec_ids = spec_ids
111
- return wrapper
135
+ wrapper._spec_ids = spec_ids
136
+ return wrapper
112
137
 
113
138
  return decorator
@@ -37,28 +37,45 @@ def _discover_from_files(tests_dir: Path) -> dict[str, SpecTest]:
37
37
  except SyntaxError:
38
38
  continue
39
39
 
40
- for node in ast.walk(tree):
41
- if not isinstance(node, ast.FunctionDef):
42
- continue
43
-
44
- spec_info = _extract_spec_decorator(node)
45
- if spec_info:
46
- spec_id, description = spec_info
47
- # Use file path format for pytest: /path/to/file.py::test_name
48
- test_path = f"{py_file}::{node.name}"
49
-
50
- spec_tests[spec_id] = SpecTest(
51
- spec_id=spec_id,
52
- description=description,
53
- test_path=test_path,
54
- test_file=py_file,
55
- test_line=node.lineno,
56
- )
40
+ # Process top-level functions
41
+ for node in tree.body:
42
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
43
+ spec_info = _extract_spec_decorator(node)
44
+ if spec_info:
45
+ spec_id, description = spec_info
46
+ test_path = f"{py_file}::{node.name}"
47
+ spec_tests[spec_id] = SpecTest(
48
+ spec_id=spec_id,
49
+ description=description,
50
+ test_path=test_path,
51
+ test_file=py_file,
52
+ test_line=node.lineno,
53
+ )
54
+
55
+ # Process methods inside classes
56
+ elif isinstance(node, ast.ClassDef):
57
+ class_name = node.name
58
+ for item in node.body:
59
+ if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef)):
60
+ spec_info = _extract_spec_decorator(item)
61
+ if spec_info:
62
+ spec_id, description = spec_info
63
+ # pytest format: file.py::ClassName::method_name
64
+ test_path = f"{py_file}::{class_name}::{item.name}"
65
+ spec_tests[spec_id] = SpecTest(
66
+ spec_id=spec_id,
67
+ description=description,
68
+ test_path=test_path,
69
+ test_file=py_file,
70
+ test_line=item.lineno,
71
+ )
57
72
 
58
73
  return spec_tests
59
74
 
60
75
 
61
- def _extract_spec_decorator(node: ast.FunctionDef) -> Optional[tuple[str, str]]:
76
+ def _extract_spec_decorator(
77
+ node: ast.FunctionDef | ast.AsyncFunctionDef,
78
+ ) -> Optional[tuple[str, str]]:
62
79
  """Extract @spec decorator info from a function node."""
63
80
  for decorator in node.decorator_list:
64
81
  if isinstance(decorator, ast.Call):
@@ -0,0 +1,135 @@
1
+ """Tests for the @spec decorator."""
2
+
3
+ import pytest
4
+
5
+ from spec_test import get_spec_registry, spec, specs
6
+ from spec_test.decorators import clear_registry
7
+
8
+
9
+ @pytest.fixture(autouse=True)
10
+ def clean_registry():
11
+ """Clear registry before each test."""
12
+ clear_registry()
13
+ yield
14
+ clear_registry()
15
+
16
+
17
+ @spec("DEC-001", "@spec decorator registers test in global registry")
18
+ def test_spec_decorator_registers_in_registry():
19
+ """Test that @spec decorator adds to global registry."""
20
+ clear_registry()
21
+
22
+ @spec("TEST-001", "Test description")
23
+ def sample_test():
24
+ pass
25
+
26
+ registry = get_spec_registry()
27
+ assert "TEST-001" in registry
28
+ assert len(registry["TEST-001"]) == 1
29
+ assert registry["TEST-001"][0]["description"] == "Test description"
30
+
31
+
32
+ @spec("DEC-002", "@spec decorator adds pytest marker to test")
33
+ def test_spec_decorator_adds_pytest_marker():
34
+ """Test that @spec decorator adds pytest markers."""
35
+
36
+ @spec("TEST-002", "Test description")
37
+ def sample_test():
38
+ pass
39
+
40
+ # Check that the function has spec metadata
41
+ assert hasattr(sample_test, "_spec_id")
42
+ assert sample_test._spec_id == "TEST-002"
43
+
44
+
45
+ @spec("DEC-003", "@spec decorator preserves function metadata")
46
+ def test_spec_decorator_preserves_metadata():
47
+ """Test that @spec decorator preserves function name and docstring."""
48
+
49
+ @spec("TEST-003", "Test description")
50
+ def sample_test():
51
+ """This is a docstring."""
52
+ pass
53
+
54
+ assert sample_test.__name__ == "sample_test"
55
+ assert sample_test.__doc__ == "This is a docstring."
56
+
57
+
58
+ @spec("DEC-004", "@specs decorator supports multiple spec IDs")
59
+ def test_specs_decorator_multiple_ids():
60
+ """Test that @specs decorator handles multiple spec IDs."""
61
+ clear_registry()
62
+
63
+ @specs("TEST-A", "TEST-B", "TEST-C")
64
+ def multi_spec_test():
65
+ pass
66
+
67
+ registry = get_spec_registry()
68
+ assert "TEST-A" in registry
69
+ assert "TEST-B" in registry
70
+ assert "TEST-C" in registry
71
+ assert hasattr(multi_spec_test, "_spec_ids")
72
+ assert multi_spec_test._spec_ids == ("TEST-A", "TEST-B", "TEST-C")
73
+
74
+
75
+ @spec("DEC-005", "@spec decorator preserves async function behavior")
76
+ @pytest.mark.asyncio
77
+ async def test_spec_decorator_preserves_async():
78
+ """Test that @spec decorator works with async functions."""
79
+ import asyncio
80
+
81
+ @spec("TEST-ASYNC-001", "Async test description")
82
+ async def async_sample_test():
83
+ await asyncio.sleep(0.001)
84
+ return "async_result"
85
+
86
+ # Verify the wrapper is still a coroutine function
87
+ assert asyncio.iscoroutinefunction(async_sample_test)
88
+
89
+ # Verify it can be awaited and returns correct result
90
+ result = await async_sample_test()
91
+ assert result == "async_result"
92
+
93
+ # Verify metadata is preserved
94
+ assert hasattr(async_sample_test, "_spec_id")
95
+ assert async_sample_test._spec_id == "TEST-ASYNC-001"
96
+
97
+
98
+ @spec("DEC-006", "@spec decorator works regardless of decorator order with pytest.mark.asyncio")
99
+ @pytest.mark.asyncio
100
+ async def test_spec_decorator_order_independence():
101
+ """Test that @spec works regardless of decorator ordering with pytest.mark.asyncio."""
102
+ import asyncio
103
+
104
+ # Test with @spec below @pytest.mark.asyncio (the problematic order before fix)
105
+ @spec("TEST-ASYNC-002", "Async test with spec below mark")
106
+ async def async_test_spec_below():
107
+ await asyncio.sleep(0.001)
108
+ return "result"
109
+
110
+ assert asyncio.iscoroutinefunction(async_test_spec_below)
111
+ result = await async_test_spec_below()
112
+ assert result == "result"
113
+
114
+
115
+ @spec("DEC-007", "@specs decorator preserves async function behavior")
116
+ @pytest.mark.asyncio
117
+ async def test_specs_decorator_preserves_async():
118
+ """Test that @specs decorator works with async functions."""
119
+ import asyncio
120
+
121
+ @specs("TEST-ASYNC-A", "TEST-ASYNC-B")
122
+ async def async_multi_spec_test():
123
+ await asyncio.sleep(0.001)
124
+ return "multi_async_result"
125
+
126
+ # Verify the wrapper is still a coroutine function
127
+ assert asyncio.iscoroutinefunction(async_multi_spec_test)
128
+
129
+ # Verify it can be awaited and returns correct result
130
+ result = await async_multi_spec_test()
131
+ assert result == "multi_async_result"
132
+
133
+ # Verify metadata is preserved
134
+ assert hasattr(async_multi_spec_test, "_spec_ids")
135
+ assert async_multi_spec_test._spec_ids == ("TEST-ASYNC-A", "TEST-ASYNC-B")
@@ -0,0 +1,72 @@
1
+ """Tests for the test runner/discovery."""
2
+
3
+ import tempfile
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+
8
+ from spec_test import spec
9
+ from spec_test.runner import discover_spec_tests
10
+
11
+
12
+ @spec("RUN-001", "Runner discovers @spec decorated methods inside test classes")
13
+ def test_runner_discovers_class_methods():
14
+ """Test that runner finds @spec decorators on methods inside test classes."""
15
+ with tempfile.TemporaryDirectory() as tmpdir:
16
+ tmpdir = Path(tmpdir)
17
+
18
+ # Create test file with class-based tests
19
+ (tmpdir / "test_class.py").write_text("""
20
+ from spec_test import spec
21
+
22
+ class TestSomething:
23
+ @spec("CLASS-001", "Test inside a class")
24
+ def test_in_class(self):
25
+ assert True
26
+
27
+ @spec("CLASS-002", "Another test inside class")
28
+ def test_another(self):
29
+ assert True
30
+ """)
31
+
32
+ spec_tests = discover_spec_tests(tmpdir)
33
+
34
+ assert "CLASS-001" in spec_tests
35
+ assert "CLASS-002" in spec_tests
36
+ assert spec_tests["CLASS-001"].spec_id == "CLASS-001"
37
+ assert spec_tests["CLASS-002"].spec_id == "CLASS-002"
38
+
39
+
40
+ @spec("RUN-002", "Runner generates correct pytest node ID for class-based tests")
41
+ def test_runner_generates_correct_node_id_for_class_tests():
42
+ """Test that runner creates pytest-compatible node IDs for class methods."""
43
+ with tempfile.TemporaryDirectory() as tmpdir:
44
+ tmpdir = Path(tmpdir)
45
+
46
+ (tmpdir / "test_nodes.py").write_text("""
47
+ from spec_test import spec
48
+
49
+ class TestMyClass:
50
+ @spec("NODE-001", "Class method test")
51
+ def test_method(self):
52
+ pass
53
+
54
+ @spec("NODE-002", "Top-level function test")
55
+ def test_function():
56
+ pass
57
+ """)
58
+
59
+ spec_tests = discover_spec_tests(tmpdir)
60
+
61
+ # Class method should have ClassName in the path
62
+ assert "NODE-001" in spec_tests
63
+ class_test_path = spec_tests["NODE-001"].test_path
64
+ assert "::TestMyClass::" in class_test_path
65
+ assert "::test_method" in class_test_path
66
+
67
+ # Top-level function should NOT have a class name
68
+ assert "NODE-002" in spec_tests
69
+ func_test_path = spec_tests["NODE-002"].test_path
70
+ assert "::test_function" in func_test_path
71
+ # Should not have double colons for class
72
+ assert func_test_path.count("::") == 1
@@ -429,6 +429,19 @@ wheels = [
429
429
  { url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" },
430
430
  ]
431
431
 
432
+ [[package]]
433
+ name = "pytest-asyncio"
434
+ version = "1.3.0"
435
+ source = { registry = "https://pypi.org/simple" }
436
+ dependencies = [
437
+ { name = "pytest" },
438
+ { name = "typing-extensions", marker = "python_full_version < '3.13'" },
439
+ ]
440
+ sdist = { url = "https://files.pythonhosted.org/packages/90/2c/8af215c0f776415f3590cac4f9086ccefd6fd463befeae41cd4d3f193e5a/pytest_asyncio-1.3.0.tar.gz", hash = "sha256:d7f52f36d231b80ee124cd216ffb19369aa168fc10095013c6b014a34d3ee9e5", size = 50087, upload-time = "2025-11-10T16:07:47.256Z" }
441
+ wheels = [
442
+ { url = "https://files.pythonhosted.org/packages/e5/35/f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da/pytest_asyncio-1.3.0-py3-none-any.whl", hash = "sha256:611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5", size = 15075, upload-time = "2025-11-10T16:07:45.537Z" },
443
+ ]
444
+
432
445
  [[package]]
433
446
  name = "pytest-cov"
434
447
  version = "7.0.0"
@@ -493,7 +506,7 @@ wheels = [
493
506
 
494
507
  [[package]]
495
508
  name = "spec-test"
496
- version = "0.1.0"
509
+ version = "0.1.2"
497
510
  source = { editable = "." }
498
511
  dependencies = [
499
512
  { name = "pydantic" },
@@ -509,6 +522,11 @@ dev = [
509
522
  { name = "ruff" },
510
523
  ]
511
524
 
525
+ [package.dev-dependencies]
526
+ dev = [
527
+ { name = "pytest-asyncio" },
528
+ ]
529
+
512
530
  [package.metadata]
513
531
  requires-dist = [
514
532
  { name = "mypy", marker = "extra == 'dev'", specifier = ">=1.0.0" },
@@ -521,6 +539,9 @@ requires-dist = [
521
539
  ]
522
540
  provides-extras = ["dev"]
523
541
 
542
+ [package.metadata.requires-dev]
543
+ dev = [{ name = "pytest-asyncio", specifier = ">=1.3.0" }]
544
+
524
545
  [[package]]
525
546
  name = "tomli"
526
547
  version = "2.4.0"
@@ -1 +0,0 @@
1
- dist/
@@ -1,72 +0,0 @@
1
- """Tests for the @spec decorator."""
2
-
3
- import pytest
4
-
5
- from spec_test import get_spec_registry, spec, specs
6
- from spec_test.decorators import clear_registry
7
-
8
-
9
- @pytest.fixture(autouse=True)
10
- def clean_registry():
11
- """Clear registry before each test."""
12
- clear_registry()
13
- yield
14
- clear_registry()
15
-
16
-
17
- @spec("DEC-001", "@spec decorator registers test in global registry")
18
- def test_spec_decorator_registers_in_registry():
19
- """Test that @spec decorator adds to global registry."""
20
- clear_registry()
21
-
22
- @spec("TEST-001", "Test description")
23
- def sample_test():
24
- pass
25
-
26
- registry = get_spec_registry()
27
- assert "TEST-001" in registry
28
- assert len(registry["TEST-001"]) == 1
29
- assert registry["TEST-001"][0]["description"] == "Test description"
30
-
31
-
32
- @spec("DEC-002", "@spec decorator adds pytest marker to test")
33
- def test_spec_decorator_adds_pytest_marker():
34
- """Test that @spec decorator adds pytest markers."""
35
-
36
- @spec("TEST-002", "Test description")
37
- def sample_test():
38
- pass
39
-
40
- # Check that the function has spec metadata
41
- assert hasattr(sample_test, "_spec_id")
42
- assert sample_test._spec_id == "TEST-002"
43
-
44
-
45
- @spec("DEC-003", "@spec decorator preserves function metadata")
46
- def test_spec_decorator_preserves_metadata():
47
- """Test that @spec decorator preserves function name and docstring."""
48
-
49
- @spec("TEST-003", "Test description")
50
- def sample_test():
51
- """This is a docstring."""
52
- pass
53
-
54
- assert sample_test.__name__ == "sample_test"
55
- assert sample_test.__doc__ == "This is a docstring."
56
-
57
-
58
- @spec("DEC-004", "@specs decorator supports multiple spec IDs")
59
- def test_specs_decorator_multiple_ids():
60
- """Test that @specs decorator handles multiple spec IDs."""
61
- clear_registry()
62
-
63
- @specs("TEST-A", "TEST-B", "TEST-C")
64
- def multi_spec_test():
65
- pass
66
-
67
- registry = get_spec_registry()
68
- assert "TEST-A" in registry
69
- assert "TEST-B" in registry
70
- assert "TEST-C" in registry
71
- assert hasattr(multi_spec_test, "_spec_ids")
72
- assert multi_spec_test._spec_ids == ("TEST-A", "TEST-B", "TEST-C")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes