diff --git a/pandas/tests/io/test_excel.py b/pandas/tests/io/test_excel.py index 84383afed1d03..717e9bc23c6b1 100644 --- a/pandas/tests/io/test_excel.py +++ b/pandas/tests/io/test_excel.py @@ -698,7 +698,7 @@ def test_excel_read_buffer(self, ext): def test_bad_engine_raises(self, ext): bad_engine = 'foo' - with pytest.raises(ValueError, message="Unknown engine: foo"): + with pytest.raises(ValueError, match="Unknown engine: foo"): read_excel('', engine=bad_engine) @tm.network diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 55b738a56f809..517a3e059469c 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -3923,7 +3923,7 @@ def test_read_column(self): # HDFStore.select_column should raise a KeyError # exception if the key is not a valid store with pytest.raises(KeyError, - message='No object named index in the file'): + match='No object named df in the file'): store.select_column('df', 'index') store.append('df', df) diff --git a/pandas/tests/scalar/timestamp/test_unary_ops.py b/pandas/tests/scalar/timestamp/test_unary_ops.py index 6fc6aa98fe950..3f9a30d254126 100644 --- a/pandas/tests/scalar/timestamp/test_unary_ops.py +++ b/pandas/tests/scalar/timestamp/test_unary_ops.py @@ -171,7 +171,7 @@ def test_round_dst_border_nonexistent(self, method, ts_str, freq): assert result is NaT with pytest.raises(pytz.NonExistentTimeError, - message='2018-03-11 02:00:00'): + match='2018-03-11 02:00:00'): getattr(ts, method)(freq, nonexistent='raise') @pytest.mark.parametrize('timestamp', [ diff --git a/pandas/tests/series/test_datetime_values.py b/pandas/tests/series/test_datetime_values.py index 52b72bcafe555..a916cf300653a 100644 --- a/pandas/tests/series/test_datetime_values.py +++ b/pandas/tests/series/test_datetime_values.py @@ -300,7 +300,7 @@ def test_dt_round_tz_nonexistent(self, method, ts_str, freq): tm.assert_series_equal(result, expected) with pytest.raises(pytz.NonExistentTimeError, - message='2018-03-11 02:00:00'): + match='2018-03-11 02:00:00'): getattr(s.dt, method)(freq, nonexistent='raise') def test_dt_namespace_accessor_categorical(self): diff --git a/pandas/tests/sparse/frame/test_frame.py b/pandas/tests/sparse/frame/test_frame.py index f908c7b263dee..bfb5103c97adc 100644 --- a/pandas/tests/sparse/frame/test_frame.py +++ b/pandas/tests/sparse/frame/test_frame.py @@ -216,8 +216,8 @@ def test_constructor_from_unknown_type(self): class Unknown(object): pass with pytest.raises(TypeError, - message='SparseDataFrame called with unknown type ' - '"Unknown" for data argument'): + match=('SparseDataFrame called with unknown type ' + '"Unknown" for data argument')): SparseDataFrame(Unknown()) def test_constructor_preserve_attr(self): diff --git a/pandas/tests/test_config.py b/pandas/tests/test_config.py index 6e47f5543012f..54db3887850ea 100644 --- a/pandas/tests/test_config.py +++ b/pandas/tests/test_config.py @@ -249,7 +249,7 @@ def test_deprecate_option(self): warnings.simplefilter('always') with pytest.raises( KeyError, - message="Nonexistent option didn't raise KeyError"): + match="No such keys.s.: 'foo'"): self.cf.get_option('foo') assert len(w) == 1 # should have raised one warning assert 'deprecated' in str(w[-1]) # we get the default message