Skip to content

Commit 2b89213

Browse files
committed
Ignore a warning added in Python 3.7.
Also set explicitly the warnings filter to default when running tests to prevent unittest from stomping on our ignore filter.
1 parent 7da5f40 commit 2b89213

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment:
22
# websockets only works on Python >= 3.4.
33
CIBW_SKIP: cp27-* cp33-*
4-
CIBW_TEST_COMMAND: python -m unittest websockets
4+
CIBW_TEST_COMMAND: python -W default -m unittest websockets
55
WEBSOCKETS_TESTS_TIMEOUT_FACTOR: 100
66

77
install:

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ env:
22
global:
33
# websockets only works on Python >= 3.4.
44
- CIBW_SKIP="cp27-* cp33-*"
5-
- CIBW_TEST_COMMAND="python3 -m unittest websockets"
5+
- CIBW_TEST_COMMAND="python3 -W default -m unittest websockets"
66
- WEBSOCKETS_TESTS_TIMEOUT_FACTOR=100
77

88
matrix:

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
export PYTHONASYNCIODEBUG=1
2-
export PYTHONWARNINGS=default
32

43
test:
5-
python -m unittest
4+
python -W default -m unittest
65

76
coverage:
87
python -m coverage erase
9-
python -m coverage run --branch --source=websockets -m unittest
8+
python -W default -m coverage run --branch --source=websockets -m unittest
109
python -m coverage html
1110

1211
clean:

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ commands =
1212
; Before testing with speedups, compile the extension.
1313
speedups: python setup.py --quiet build_ext --inplace
1414

15-
python -m unittest {posargs}
15+
python -W default -m unittest {posargs}
1616

1717
; After testing with speedups, remove the extension.
1818
speedups: sh -c 'rm websockets/*.so'
@@ -27,7 +27,7 @@ commands =
2727
python setup.py --quiet build_ext --inplace
2828

2929
python -m coverage erase
30-
python -m coverage run --branch --source=websockets -m unittest
30+
python -W default -m coverage run --branch --source=websockets -m unittest
3131
python -m coverage report --show-missing --fail-under=100
3232

3333
speedups: sh -c 'rm websockets/*.so'

websockets/protocol.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import logging
1616
import random
1717
import struct
18+
import warnings
1819

1920
from .compatibility import asyncio_ensure_future
2021
from .exceptions import (
@@ -29,6 +30,16 @@
2930
logger = logging.getLogger(__name__)
3031

3132

33+
# On Python ≥ 3.7, silence a deprecation warning that we can't address before
34+
# dropping support for Python < 3.5.
35+
warnings.filterwarnings(
36+
action='ignore',
37+
message=r"'with \(yield from lock\)' is deprecated "
38+
r"use 'async with lock' instead",
39+
category=DeprecationWarning,
40+
)
41+
42+
3243
# A WebSocket connection goes through the following four states, in order:
3344

3445
class State(enum.IntEnum):

0 commit comments

Comments
 (0)