Skip to content

Commit 7dd0fac

Browse files
committed
TST: skip some non-us locale tests with guessing datetimes
1 parent a7c90e1 commit 7dd0fac

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pandas/tseries/tests/test_timeseries.py

+3
Original file line numberDiff line numberDiff line change
@@ -5492,7 +5492,9 @@ def test_to_datetime_iso8601_noleading_0s(self):
54925492

54935493

54945494
class TestGuessDatetimeFormat(tm.TestCase):
5495+
54955496
def test_guess_datetime_format_with_parseable_formats(self):
5497+
tm._skip_if_not_us_locale()
54965498
dt_string_to_format = (('20111230', '%Y%m%d'),
54975499
('2011-12-30', '%Y-%m-%d'),
54985500
('30-12-2011', '%d-%m-%Y'),
@@ -5567,6 +5569,7 @@ def test_guess_datetime_format_nopadding(self):
55675569
)
55685570

55695571
def test_guess_datetime_format_for_array(self):
5572+
tm._skip_if_not_us_locale()
55705573
expected_format = '%Y-%m-%d %H:%M:%S.%f'
55715574
dt_string = datetime(2011, 12, 30, 0, 0, 0).strftime(expected_format)
55725575

pandas/util/testing.py

+8
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ def _skip_if_has_locale():
404404
import nose
405405
raise nose.SkipTest("Specific locale is set {0}".format(lang))
406406

407+
408+
def _skip_if_not_us_locale():
409+
import locale
410+
lang, _ = locale.getlocale()
411+
if lang != 'en_US':
412+
import nose
413+
raise nose.SkipTest("Specific locale is set {0}".format(lang))
414+
407415
# -----------------------------------------------------------------------------
408416
# locale utilities
409417

0 commit comments

Comments
 (0)