TST: remove never-used singleton fixtures
State: closed

The fact that these are never used would be obvious if these were in a file not ignored by coverage, i.e. not relying on pytest magic.

broken off of #24873.

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Clean

Comments:
> nope how about we use them

Where?  Buddy, you're usually the president of the "remove unused/duplicate code" club.

Wait, shoot.  Did you and josef-pkt have a Freaky-Friday body-swap?
my point is i would rather add fixture use in tests/frame and then see what falls out

i am of course amenable to removing things but one offs are not great for this
You want to add tests specifically to get fixture coverage?  I mean, I could implement a "test":

```
def test_cargo_cult(otherwise_unused_fixture):
    pass
```

and you would prefer that over removing unused code?

I guess it might not be a Freaky Friday, situation, it could also be one of [these](https://www.youtube.com/watch?v=GEStsLJZhzo)

btw you know you can simply import fixtures and call them as functions?

I am not sure of your debugging pattern, but I never need to actually call functions in a terminal
I exclusively use tests; just out a breakpoint in the test (or use —orb) and it works very nicely
the reason these fixtures were pulled out is to start a pattern; let’s continue rather than reverse 
> btw you know you can simply import fixtures and call them as functions?

That had been deprecated and has been removed in pytest 4.0: https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24885?src=pr&el=h1) Report
> Merging [#24885](https://codecov.io/gh/pandas-dev/pandas/pull/24885?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/14eac280e1b7516714d117e65b45023dee7feee7?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #24885   +/-   ##
=======================================
  Coverage   92.39%   92.39%           
=======================================
  Files         166      166           
  Lines       52413    52413           
=======================================
  Hits        48425    48425           
  Misses       3988     3988
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.81% <ø> (ø)` | :arrow_up: |
| #single | `42.89% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24885?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/24885?src=pr&el=footer). Last update [14eac28...2946c5d](https://codecov.io/gh/pandas-dev/pandas/pull/24885?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24885?src=pr&el=h1) Report
> Merging [#24885](https://codecov.io/gh/pandas-dev/pandas/pull/24885?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b6731886db957b3e667449f67b6c95a638f2ac81?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #24885   +/-   ##
=======================================
  Coverage   91.73%   91.73%           
=======================================
  Files         173      173           
  Lines       52845    52845           
=======================================
  Hits        48479    48479           
  Misses       4366     4366
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.3% <ø> (ø)` | :arrow_up: |
| #single | `41.73% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24885?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/24885?src=pr&el=footer). Last update [b673188...2bbeae8](https://codecov.io/gh/pandas-dev/pandas/pull/24885?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@h-vetinari that's not right. calling then *inside* of a test function is deprecated. calling them directory is certainly possible, after all they are just a function.

> Calling a fixture function directly, as opposed to request them in a test function, is deprecated.


@jreback 

I had read over the debugging part, but I just tried it in a REPL, and it doesn't work:
```
(pandas-dev) C:\Users\[...]\pddev>python
Python 3.7.2 (default, Jan  2 2019, 17:07:39) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from pandas.conftest import *
C:\ProgramData\Miniconda3\envs\pandas-dev\lib\site-packages\hypothesis\_settings.py:193: HypothesisDeprecationWarning: The timeout setting can safely be removed with no effect.
  verbosity=self.verbosity,
>>>
>>> any_numpy_dtype()
Traceback (most recent call last):
[...]
Failed: Fixture "any_numpy_dtype" called directly. Fixtures are not meant to be called directly,
but are created automatically when test functions request them as parameters.
See https://docs.pytest.org/en/latest/fixture.html for more information about fixtures, and
https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly about how to update your code.
```
... none of which is relevant because these fixtures are *NEVER USED*.

Besides which, @jreback in none of these threads have you acknowledged the fact that we have at least one case where the fixture is behaving differently from the non-fixture implementation.  In at least that one case, what we are testing is not the same behavior as what users will see.
> we have at least one case where the fixture is behaving differently from the non-fixture implementation.

@jbrockmendel admittedly haven't kept up on the entire thread but you aren't referring to #24826 here are you? That wasn't an issue with the fixture as much as the test definition itself which should now be corrected
> That wasn't an issue with the fixture as much as the test definition itself which should now be corrected

That was one guess about what was going on.  I'm pretty sure I've rebased+pushed more recently than that, but will do so again to double-check.
> @jbrockmendel: ... none of which is relevant because these fixtures are NEVER USED.

I have no dog in this fight, I'm only pointing out that for the purpose of this discussion, "never used" must include the `TestData`-attributes-as-fixtures that have not been translated yet as per #22471.

That means, that e.g. `tests.frame.conftest.float_frame2` is conceptually and semantically the same as `tests.frame.common.TestData.frame2`, and the latter *does* get used (once, in `tests\frame\test_to_csv.py`).

Now, would it be possible to refactor the affected tests? - of course. I'm just saying that the fixtures you say are never used, actually have a synonymous `TestData`-attribute that may or may not have been translated yet fully (btw, I specifically wanted to avoid this situation that the names diverge for the duration of the transition, but was overruled). If *both* are not being used, I'm all for removal.

@h-vetinari thank you for clarifying.  Apologies if I came off as snapping at you.  This has been frustrating.
@WillAyd nope, after rebasing #24769 still has failing builds.  Fixture versions are definitely behaving differently from non-fixture versions.

I'm stepping away from this for a while.  Maybe jreback will care about this after his Freaky Friday body swap gets un-done.
Just rebased.  Assuming the CI shows these haven't been put into use since the PR was opened, keeping unused code around remains a Bad Idea.  @jreback most of the other fixture-related PRs have been closed, but this one should be easy.
ok @jbrockmendel but ideally would like to convert things that use setup functions and the older class testing structure in pandas/tests/frame before changing more fixtures.