Skip to content

ATOM-REFACTOR-20260119-001-pytest-test-discovery#168

Merged
toolate28 merged 4 commits intocopilot/refine-prompt-toolkit-collaborationfrom
copilot/sub-pr-156
Jan 19, 2026
Merged

ATOM-REFACTOR-20260119-001-pytest-test-discovery#168
toolate28 merged 4 commits intocopilot/refine-prompt-toolkit-collaborationfrom
copilot/sub-pr-156

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Summary

The TestAwiPromptGen class was not discoverable by pytest because it lacked unittest.TestCase inheritance and used a custom test runner instead of pytest conventions.

ATOM Tag

ATOM: ATOM-REFACTOR-20260119-001-pytest-test-discovery

Why

Pytest test discovery requires either:

  1. Test classes inheriting from unittest.TestCase, or
  2. Standalone test_* functions

The custom class with run_all() method bypassed pytest's discovery mechanism, making tests invisible to CI and manual pytest runs.

What changed

  • Converted class-based tests to 7 standalone test_* functions
  • Replaced custom self.test() assertions with standard assert statements
  • Removed test runner infrastructure (__init__, run_all(), pass/fail counters)
  • Reduced file from 299 to 161 lines while preserving all test logic

Before:

class TestAwiPromptGen:
    def test(self, name: str, condition: bool, error_msg: str = ""):
        if condition:
            print(f"  ✅ PASS: {name}")
            self.passed += 1
        else:
            print(f"  ❌ FAIL: {name}")
            self.failed += 1
    
    def test_scaffolder_refiner_integration(self):
        gen = AwiPromptGen()
        result = gen(user_intent="...", history=[...])
        self.test("Result is Prediction", isinstance(result, Prediction))

After:

def test_scaffolder_refiner_integration():
    """Test that scaffolder and refiner work together correctly."""
    gen = AwiPromptGen()
    result = gen(user_intent="...", history=[...])
    assert isinstance(result, Prediction), f"Expected Prediction, got {type(result)}"

Verification / Testing

  • All 7 tests discovered by pytest --collect-only
  • All 7 tests pass with pytest -v
  • Follows pattern in ops/integrations/*/tests/test_*.py
  • ATOM tag created and logged

Claude Interaction

You can interact with Claude in this PR by:

  • @mentioning Claude in comments for questions or reviews
  • Adding labels: claude:review, claude:help, claude:analyze
  • Requesting reviews: Claude will provide automated feedback
  • Ask questions: Claude can explain code, suggest improvements, or identify issues

Example commands:

  • @claude please review this PR for ATOM compliance
  • @claude explain the changes in scripts/atom-track.sh
  • @claude check for security issues
  • @claude suggest improvements

Notes

Checklist

  • ATOM tag created and referenced
  • Tests passing
  • Documentation updated (test file is self-documenting)
  • No secrets committed
  • Follows existing patterns
  • Ready for Claude review

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Contributor

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
h.and.s Ready Ready Preview, Comment Jan 19, 2026 4:51pm

Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
Copilot AI changed the title [WIP] Update test class to inherit from unittest.TestCase refactor: Convert AWI prompt gen tests to pytest-compatible functions Jan 19, 2026
Copilot AI requested a review from toolate28 January 19, 2026 16:00
…ot/sub-pr-156

Signed-off-by: toolated <toolated@pm.me>
@github-actions
Copy link

🌀 Agent Review - Coherence Analysis

🚨 Critical - Wave function collapse imminent

Overall Coherence: NaN%


📊 Detailed Metrics

Metric Value Gauge
🔄 Curl (Coherence) 5.1% █░░░░░░░░░ 5.1%
📐 Divergence (Incompleteness) NaN% NaN%
🎲 Entropy (Info Density) 54.8% █████░░░░░ 54.8%

📈 Analysis Summary

  • Files Analyzed: 189
  • Excellent (>80%): 0 files
  • Needs Attention (<50%): 2 files

🔬 Ethical Quantum Simulation Status

⚠️ Needs Review - Coherence below threshold (<60%)

  • Wave function integrity: ⚠️
  • Decoherence detected: ⚠️
  • Review recommended before merge
⚠️ Files Needing Attention (2)
  • ./docs/specs/lambda_zero.md
  • ./docs/TROUBLESHOOTING_MCP.md

🎯 Merge Status

Review required - Coherence below threshold.

Please address coherence issues before merging.


🤖 Generated by SpiralSafe Coherence Gauge v2.0 | Powered by Quantum Topology

@toolate28 toolate28 changed the title refactor: Convert AWI prompt gen tests to pytest-compatible functions ATOM-REFACTOR-20260119-001-pytest-test-discovery Jan 19, 2026
…ot/sub-pr-156

Signed-off-by: toolated <toolated@pm.me>
@toolate28 toolate28 marked this pull request as ready for review January 19, 2026 16:52
Copilot AI review requested due to automatic review settings January 19, 2026 16:52
@github-actions
Copy link

🌀 Agent Review - Coherence Analysis

🚨 Critical - Wave function collapse imminent

Overall Coherence: NaN%


📊 Detailed Metrics

Metric Value Gauge
🔄 Curl (Coherence) 5.1% █░░░░░░░░░ 5.1%
📐 Divergence (Incompleteness) NaN% NaN%
🎲 Entropy (Info Density) 54.8% █████░░░░░ 54.8%

📈 Analysis Summary

  • Files Analyzed: 189
  • Excellent (>80%): 0 files
  • Needs Attention (<50%): 2 files

🔬 Ethical Quantum Simulation Status

⚠️ Needs Review - Coherence below threshold (<60%)

  • Wave function integrity: ⚠️
  • Decoherence detected: ⚠️
  • Review recommended before merge
⚠️ Files Needing Attention (2)
  • ./docs/specs/lambda_zero.md
  • ./docs/TROUBLESHOOTING_MCP.md

🎯 Merge Status

Review required - Coherence below threshold.

Please address coherence issues before merging.


🤖 Generated by SpiralSafe Coherence Gauge v2.0 | Powered by Quantum Topology

@toolate28 toolate28 merged commit fbd4b4e into copilot/refine-prompt-toolkit-collaboration Jan 19, 2026
15 of 17 checks passed
@toolate28 toolate28 deleted the copilot/sub-pr-156 branch January 19, 2026 16:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the TestAwiPromptGen test suite to make it compatible with pytest's test discovery mechanism. The original implementation used a custom test class without unittest.TestCase inheritance and a custom run_all() method, which prevented pytest from discovering the tests.

Changes:

  • Converted class-based tests to 7 standalone test_* functions compatible with pytest discovery
  • Replaced custom assertion framework with standard Python assert statements and descriptive error messages
  • Removed test infrastructure code (custom runner, counters, if __name__ == "__main__" block)

Comment on lines +107 to +108
assert '\\n' in result.content or '\n injected' not in result.content, \
"Newlines in intent should be escaped"
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "Newlines in intent should be escaped" is less informative than the original "Newlines in intent should be escaped or sanitized to prevent YAML injection". Consider restoring the more detailed message that explains the security rationale for this check.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants