# DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal

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

## Root Cause

The test suite runs with -W error or filterwarnings=error, promoting a DeprecationWarning from application or third-party code into a test failure.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   from datetime import datetime, timezone
dt = datetime.now(timezone.utc)
   ```
2. **** (88% success)
   ```
   # pyproject.toml
[tool.pytest.ini_options]
filterwarnings = [
  "error",
  "ignore::DeprecationWarning:legacy_lib.*",
  "ignore:datetime.datetime.utcnow:DeprecationWarning",
]
   ```

## Dead Ends

- **** — noqa is for linters; pytest's warning filter isn't affected by inline noqa comments. (85% fail)
- **** — Doesn't fix the deprecated call; the warning still fires elsewhere in the codebase. (70% fail)
