Skip to content
Myr

Skip aware datetime tests if pytz is unavailable

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Eugene M. Kim · committed by Eugene M. Kim · parent eb96183 · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • tests:+7 added−1 removed

1 file+7 added−1 removed

modified:tests/test_helpers.py+7 added-1 removed
21 unmodified lines
22from werkzeug.http import parse_cache_control_header, parse_options_header23from werkzeug.http import http_date24from flask._compat import StringIO, text_type25from flask.helpers import get_debug_flag, make_response26try:26from pytz import timezone27 from pytz import timezone28except ImportError:29 has_pytz = False30else:31 has_pytz = True323334def has_encoding(name):35 try:
146 unmodified lines
182 rv = client.get(url)183 assert rv.mimetype == 'application/json'184 assert flask.json.loads(rv.data)['x'] == http_date(d.timetuple())185186 @pytest.mark.skipif('not has_pytz')187 @pytest.mark.parametrize('tzname', ('UTC', 'PST8PDT', 'Asia/Seoul'))188 def test_jsonify_aware_datetimes(self, tzname):189 """Test if aware datetime.datetime objects are converted into GMT."""190 dt_naive = datetime.datetime(2017, 1, 1, 12, 34, 56)
772 unmodified lines