TST: fixtures for timezones
State: closed

This is a follow up for #20287 

Different tests use different lists of timezones and it's kind of hard to unify all of them. In this PR I tried to create a fixture that covers most frequent cases. Some tests use naive timezone, while others are designed to use only explicit timezones (and fail in case tz is not specified), that's why I created two fixtures to cover these two group of tests. List of timezones also includes one dateutil-timezone. 
 I'm not sure if described approach is correct though so I would appreciate any feedback.

- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Timezones
description: Timezone data dtype

Comments:
@jbrockmendel ?
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=h1) Report
> Merging [#20365](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/a77ac2bb9fc47b970378985446e6b983ac51a6b7?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/20365/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #20365      +/-   ##
==========================================
- Coverage   91.84%   91.82%   -0.03%     
==========================================
  Files         152      152              
  Lines       49264    49269       +5     
==========================================
- Hits        45246    45239       -7     
- Misses       4018     4030      +12
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.2% <100%> (-0.03%)` | :arrow_down: |
| #single | `41.91% <100%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/\_test\_decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/20365/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX3Rlc3RfZGVjb3JhdG9ycy5weQ==) | `92.4% <100%> (+0.51%)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/20365/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.07% <0%> (-1.74%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=footer). Last update [a77ac2b...2573948](https://codecov.io/gh/pandas-dev/pandas/pull/20365?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

A few thoughts, in no particular order:

- Generally looks quite nice.  @almaleksia thanks for putting this together.
- I'm a bit concerned about always using the same ~4 timezones.  Is there a risk of some special case weirdness in other timezones that we're missing?
- Would there be a use for separate fixtures for tzstr for tzinfo objects?
@jreback @jbrockmendel 
thank you for the feedback!

> I'm a bit concerned about always using the same ~4 timezones. Is there a risk of some special case weirdness in other timezones that we're missing?

Actually I had the same thought. As for this change, it affects only tests that already share similar list of timezones. I made sure that I didn't shorten or replace timezone lists used in the existing tests. Let's say test is using some timezone not covered by the fixture then list is not replaced. Several tests though got extended by one timezone (dateutil/US/Pacific) after being moved to the fixture. I thought about adding more timezones to the list but for some tests it looked a bit redundant, so I decided to save some build time.

> Would there be a use for separate fixtures for tzstr for tzinfo objects?

do you mean tests like in test_timezones parametrized with tzstr?
> I thought about adding more timezones to the list but for some tests it looked a bit redundant, so I decided to save some build time.

I think that's the right choice. This would be a decent case for using hypothesis: https://github.com/pandas-dev/pandas/issues/17978 (but that's for another issue)
can you rebase this just to make sure
Thanks @almaleksia!