BUG: record warnings related to DatetimeIndex
- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

This PR handles warnings emitted when running tests in ``pandas/tests/plotting/test_datetimelike.py``.
Warnings looked like this:

```
pandas/tests/plotting/test_datetimelike.py::TestTSPlot::test_irreg_dtypes
  /workspaces/pandas/pandas/core/frame.py:3216: FutureWarning: Automatically casting object-dtype Index of datetimes to DatetimeIndex is deprecated and will be removed in a future version.  Explicitly cast to DatetimeIndex instead.
    return klass(values, index=self.index, name=name, fastpath=True)
```

Presumably it started after implementing this: https://github.com/pandas-dev/pandas/pull/36697/

The reason for not using ``tm.assert_produces_warning`` is that when I use it,
then I get an error that the warning is raised with the incorrect stacklevel.