# AssertionError: assert '' == 'hello\n'
  +  where '' = capsys.readouterr().out

- **ID:** `python/pytest-capsys-not-captured`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Output was written to a logging handler, a subprocess, or a C-level fd, none of which capsys captures. capsys only captures Python-level sys.stdout/stderr writes.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   def test_cli(capfd):
    import subprocess, sys
    subprocess.run([sys.executable, "-c", "print('hello')"])
    out, err = capfd.readouterr()
    assert out == "hello\n"
   ```
2. **** (94% success)
   ```
   import logging

def test_log(caplog):
    with caplog.at_level(logging.INFO):
        logging.getLogger("app").info("hello")
    assert "hello" in caplog.text
   ```

## Dead Ends

- **** — Each call drains the buffer; repeated calls return empty strings after the first. (80% fail)
- **** — That disables capture entirely; the assertion still sees nothing. (70% fail)
