# DeprecationWarning: datetime.datetime.utcnow() is deprecated
FAILED tests/test_time.py::test_now - DeprecationWarning: ...

- **ID:** `python/pytest-warnings-as-errors-failing-ci`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

CI runs pytest with `-W error` (or `filterwarnings = error` in config), so any DeprecationWarning raised during test execution becomes a failure. This often appears after a Python minor upgrade.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.12 | active | — | — |
| 3.13 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Ignore specific known-safe warnings via pytest config:

# pyproject.toml
[tool.pytest.ini_options]
filterwarnings = [
  "error",
  "ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning",
]
   ```
2. **** (98% success)
   ```
   Fix the deprecated call site:

from datetime import datetime, timezone
datetime.now(timezone.utc)  # replaces utcnow()
   ```

## Dead Ends

- **** — Hides all warnings, including ones the team intentionally turned into errors to catch regressions. (60% fail)
- **** — Only suppresses in that scope; other tests using the same deprecated API still fail. (70% fail)
