# ERROR collecting tests/test_models.py
E   SyntaxError: invalid syntax. Perhaps you forgot a comma?
  tests/test_models.py:42
    assert user.name == "alice" "bob"

- **ID:** `python/pytest-collection-failed-syntax`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A syntax error in a test file prevents pytest from importing it, which aborts collection for that file and shows a collection error rather than a test failure. Often caused by implicit string concatenation, missing commas, or Python 2 syntax.

## Version Compatibility

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

## Workarounds

1. **** (98% success)
   ```
   python -m py_compile tests/test_models.py
# or
python -c "import ast; ast.parse(open('tests/test_models.py').read())"
   ```
2. **** (95% success)
   ```
   # Wrong
assert user.name == "alice" "bob"
# Right
assert user.name in {"alice", "bob"}
   ```

## Dead Ends

- **** — -x stops on first failure; the syntax error still aborts collection and no tests run. (85% fail)
- **** — Lets other files run, but the broken file still contributes zero tests, masking the real problem. (60% fail)
