Skip to content

TST/CLN: Exception catching #28587

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
Sep 24, 2019
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion pandas/tests/indexing/test_iloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pandas as pd
from pandas import DataFrame, Series, concat, date_range, isna
from pandas.api.types import is_scalar
from pandas.core.indexing import IndexingError
from pandas.tests.indexing.common import Base
from pandas.util import testing as tm

Expand Down Expand Up @@ -722,7 +723,7 @@ def test_iloc_mask(self):
else:
accessor = df
ans = str(bin(accessor[mask]["nums"].sum()))
except Exception as e:
except (ValueError, IndexingError, NotImplementedError) as e:
ans = str(e)

key = tuple([idx, method])
Expand Down
12 changes: 3 additions & 9 deletions pandas/tests/io/pytables/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import pandas.util.testing as tm
from pandas.util.testing import assert_frame_equal, assert_series_equal, set_timezone

from pandas.io.formats.printing import pprint_thing
from pandas.io.pytables import (
ClosedFileError,
HDFStore,
Expand Down Expand Up @@ -3415,14 +3414,9 @@ def test_string_select(self):
expected = df[df.x == "none"]
assert_frame_equal(result, expected)

try:
result = store.select("df", "x!=none")
expected = df[df.x != "none"]
assert_frame_equal(result, expected)
except Exception as detail:
pprint_thing("[{0}]".format(detail))
pprint_thing(store)
pprint_thing(expected)
result = store.select("df", "x!=none")
expected = df[df.x != "none"]
assert_frame_equal(result, expected)

df2 = df.copy()
df2.loc[df2.x == "", "x"] = np.nan
Expand Down
6 changes: 1 addition & 5 deletions pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from shutil import rmtree
import string
import tempfile
import traceback
from typing import Union, cast
import warnings
import zipfile
Expand Down Expand Up @@ -2291,10 +2290,7 @@ def wrapper(*args, **kwargs):
" and error {error}".format(error=e)
)

try:
e_str = traceback.format_exc(e)
except Exception:
e_str = str(e)
e_str = str(e)

if any(m.lower() in e_str.lower() for m in _skip_on_messages):
skip(
Expand Down