8000 Simplify pandas fixture. by anntzer · Pull Request #10178 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Simplify pandas fixture. #10178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions lib/matplotlib/testing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,22 @@ def mpl_image_comparison_parameters(request, extension):


@pytest.fixture
def pd(request):
'''fixture to import and configure pandas'''

def pd():
"""Fixture to import and configure pandas."""
pd = pytest.importorskip('pandas')
if pd:
try:
from pandas.plotting import (
register_matplotlib_converters as register)
except ImportError:
from pandas.tseries.converter import register
register()

try:
from pandas.plotting import (
register_matplotlib_converters as register)
except ImportError:
from pandas.tseries.converter import register
register()
try:
yield pd
finally:
try:
from pandas.plotting import (
deregister_matplotlib_converters as deregister)
request.addfinalizer(deregister)
except ImportError:
pass

return pd
else:
deregister()
0