Skip to content

Commit

Permalink
Merge pull request #1578 from tirkarthi/fix-python-38-warnings
Browse files Browse the repository at this point in the history
Fix import related warnings in Python 3.8
  • Loading branch information
Zac-HD authored Sep 15, 2018
2 parents 4dba2f7 + 9cb650a commit ee9206d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ their individual contributions.
* `Joey Tuong <https://github.com/tetrapus>`_
* `Jonty Wareing <https://www.github.com/Jonty>`_ ([email protected])
* `jwg4 <https://www.github.com/jwg4>`_
* `Karthikeyan Singaravelan <https://www.github.com/tirkarthi>`_ ([email protected])
* `kbara <https://www.github.com/kbara>`_
* `Kyle Reeve <https://www.github.com/kreeve>`_ ([email protected])
* `Lee Begg <https://www.github.com/llnz2>`_
Expand Down
5 changes: 5 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RELEASE_TYPE: patch

This patch fixes a ``DeprecationWarning`` added in Python 3.8 (:issue:`1576`).

Thanks to tirkarthi for this contribution!
8 changes: 4 additions & 4 deletions hypothesis-python/src/hypothesis/internal/conjecture/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import heapq
import hashlib
from fractions import Fraction
from collections import Sequence, OrderedDict
from collections import OrderedDict

from hypothesis._settings import note_deprecation
from hypothesis.internal.compat import floor, hbytes, hrange, qualname, \
bit_length, str_to_bytes, int_from_bytes
from hypothesis.internal.compat import abc, floor, hbytes, hrange, \
qualname, bit_length, str_to_bytes, int_from_bytes
from hypothesis.internal.floats import int_to_float

LABEL_MASK = 2 ** 64 - 1
Expand Down Expand Up @@ -126,7 +126,7 @@ def check_sample(values, strategy_name):
'want to sample slices. Sampling a multi-dimensional '
'array will be an error in a future version of Hypothesis.'
).format(ndim=values.ndim, shape=values.shape))
elif not isinstance(values, (OrderedDict, Sequence, enum.EnumMeta)):
elif not isinstance(values, (OrderedDict, abc.Sequence, enum.EnumMeta)):
note_deprecation(
'Cannot sample from {values}, not an ordered collection. '
'Hypothesis goes to some length to ensure that the {strategy} '
Expand Down
5 changes: 2 additions & 3 deletions hypothesis-python/src/hypothesis/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from inspect import isclass, isfunction
from fractions import Fraction
from functools import reduce
from collections import Sequence

import attr

Expand All @@ -39,7 +38,7 @@
from hypothesis._settings import note_deprecation
from hypothesis.internal.cache import LRUReusedCache
from hypothesis.searchstrategy import SearchStrategy, check_strategy
from hypothesis.internal.compat import gcd, ceil, floor, hrange, \
from hypothesis.internal.compat import abc, gcd, ceil, floor, hrange, \
string_types, get_type_hints, getfullargspec, typing_root_type, \
implements_iterator
from hypothesis.internal.floats import next_up, float_of, next_down, \
Expand Down Expand Up @@ -970,7 +969,7 @@ def text(
elif isinstance(alphabet, SearchStrategy):
char_strategy = alphabet
else:
if not isinstance(alphabet, Sequence):
if not isinstance(alphabet, abc.Sequence):
note_deprecation(
'alphabet must be an ordered sequence, or tests may be '
'flaky and shrinking weaker, but a %r is not a type of '
Expand Down
2 changes: 1 addition & 1 deletion tooling/src/hypothesistooling/projects/hypothesispython.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def upload_distribution():
),
timeout=120, # seconds
# Scoped personal access token, stored in Travis environ variable
auth=('Zac-HD', os.environ['Zac-release-token']),
auth=('Zac-HD', os.environ['Zac_release_token']),
).raise_for_status()


Expand Down

0 comments on commit ee9206d

Please sign in to comment.