Skip to content

Commit ab2b140

Browse files
asvetlovTinche
authored andcommitted
Test on Python 3.8, drop 3.3 and 3.4
1 parent 6397a22 commit ab2b140

8 files changed

+29
-43
lines changed

.travis.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: python
2+
23
matrix:
34
include:
45
- python: 3.5
@@ -7,10 +8,8 @@ matrix:
78
env: TOX_ENV=py36
89
- python: 3.7
910
env: TOX_ENV=py37
10-
# TODO: the dist and sudo keys are currently needed to use Python 3.7.
11-
# They should be removed once Travis-CI supports 3.7 on the default image.
12-
dist: xenial
13-
sudo: true
11+
- python: 3.8
12+
env: TOX_ENV=py38
1413

1514
install: pip install tox-travis coveralls
1615

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def find_version():
3636
"Programming Language :: Python :: 3.5",
3737
"Programming Language :: Python :: 3.6",
3838
"Programming Language :: Python :: 3.7",
39+
"Programming Language :: Python :: 3.8",
3940
"Topic :: Software Development :: Testing",
4041
"Framework :: Pytest",
4142
],

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def dependent_fixture(event_loop):
1717
async def just_a_sleep():
1818
"""Just sleep a little while."""
1919
nonlocal event_loop
20-
await asyncio.sleep(0.1, loop=event_loop)
20+
await asyncio.sleep(0.1)
2121
nonlocal counter
2222
counter += 1
2323

tests/test_hypothesis_integration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ async def test_mark_and_parametrize(x, y):
3737
@given(st.integers())
3838
@pytest.mark.asyncio
3939
async def test_can_use_fixture_provided_event_loop(event_loop, n):
40-
semaphore = asyncio.Semaphore(value=0, loop=event_loop)
40+
semaphore = asyncio.Semaphore(value=0)
4141
event_loop.call_soon(semaphore.release)
4242
await semaphore.acquire()

tests/test_simple.py

+12-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
"""Quick'n'dirty unit tests for provided fixtures and markers."""
22
import asyncio
3-
import os
43
import pytest
54

65
import pytest_asyncio.plugin
76

87

9-
async def async_coro(loop=None):
10-
"""A very simple coroutine."""
11-
await asyncio.sleep(0, loop=loop)
8+
async def async_coro():
9+
await asyncio.sleep(0)
1210
return 'ok'
1311

1412

1513
def test_event_loop_fixture(event_loop):
1614
"""Test the injection of the event_loop fixture."""
1715
assert event_loop
18-
ret = event_loop.run_until_complete(async_coro(event_loop))
16+
ret = event_loop.run_until_complete(async_coro())
1917
assert ret == 'ok'
2018

2119

2220
@pytest.mark.asyncio
23-
def test_asyncio_marker():
21+
async def test_asyncio_marker():
2422
"""Test the asyncio pytest marker."""
25-
yield # sleep(0)
23+
await asyncio.sleep(0)
2624

2725

2826
@pytest.mark.xfail(reason='need a failure', strict=True)
@@ -45,13 +43,11 @@ async def closer(_, writer):
4543
writer.close()
4644

4745
server1 = await asyncio.start_server(closer, host='localhost',
48-
port=unused_tcp_port,
49-
loop=event_loop)
46+
port=unused_tcp_port)
5047

5148
with pytest.raises(IOError):
5249
await asyncio.start_server(closer, host='localhost',
53-
port=unused_tcp_port,
54-
loop=event_loop)
50+
port=unused_tcp_port)
5551

5652
server1.close()
5753
await server1.wait_closed()
@@ -68,20 +64,16 @@ async def closer(_, writer):
6864
unused_tcp_port_factory())
6965

7066
server1 = await asyncio.start_server(closer, host='localhost',
71-
port=port1,
72-
loop=event_loop)
67+
port=port1)
7368
server2 = await asyncio.start_server(closer, host='localhost',
74-
port=port2,
75-
loop=event_loop)
69+
port=port2)
7670
server3 = await asyncio.start_server(closer, host='localhost',
77-
port=port3,
78-
loop=event_loop)
71+
port=port3)
7972

8073
for port in port1, port2, port3:
8174
with pytest.raises(IOError):
8275
await asyncio.start_server(closer, host='localhost',
83-
port=port,
84-
loop=event_loop)
76+
port=port)
8577

8678
server1.close()
8779
await server1.wait_closed()
@@ -117,7 +109,7 @@ class Test:
117109
@pytest.mark.asyncio
118110
async def test_asyncio_marker_method(self, event_loop):
119111
"""Test the asyncio pytest marker in a Test class."""
120-
ret = await async_coro(event_loop)
112+
ret = await async_coro()
121113
assert ret == 'ok'
122114

123115

tests/test_simple_35.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
@pytest.mark.asyncio
88
async def async_coro(loop):
9-
await asyncio.sleep(0, loop=loop)
9+
await asyncio.sleep(0)
1010
return 'ok'
1111

1212

@@ -27,8 +27,7 @@ async def closer(_, writer):
2727
writer.close()
2828

2929
server1 = await asyncio.start_server(closer, host='localhost',
30-
port=unused_tcp_port,
31-
loop=event_loop)
30+
port=unused_tcp_port)
3231

3332
server1.close()
3433
await server1.wait_closed()
@@ -45,20 +44,16 @@ async def closer(_, writer):
4544

4645
async def run_test():
4746
server1 = await asyncio.start_server(closer, host='localhost',
48-
port=port1,
49-
loop=event_loop)
47+
port=port1)
5048
server2 = await asyncio.start_server(closer, host='localhost',
51-
port=port2,
52-
loop=event_loop)
49+
port=port2)
5350
server3 = await asyncio.start_server(closer, host='localhost',
54-
port=port3,
55-
loop=event_loop)
51+
port=port3)
5652

5753
for port in port1, port2, port3:
5854
with pytest.raises(IOError):
5955
await asyncio.start_server(closer, host='localhost',
60-
port=port,
61-
loop=event_loop)
56+
port=port)
6257

6358
server1.close()
6459
await server1.wait_closed()

tests/test_subprocess.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ def event_loop():
2121
async def test_subprocess(event_loop):
2222
"""Starting a subprocess should be possible."""
2323
proc = await asyncio.subprocess.create_subprocess_exec(
24-
sys.executable, '--version', stdout=asyncio.subprocess.PIPE,
25-
loop=event_loop)
24+
sys.executable, '--version', stdout=asyncio.subprocess.PIPE)
2625
await proc.communicate()
2726

2827

2928
@pytest.mark.asyncio(forbid_global_loop=True)
3029
async def test_subprocess_forbid(event_loop):
3130
"""Starting a subprocess should be possible."""
3231
proc = await asyncio.subprocess.create_subprocess_exec(
33-
sys.executable, '--version', stdout=asyncio.subprocess.PIPE,
34-
loop=event_loop)
32+
sys.executable, '--version', stdout=asyncio.subprocess.PIPE)
3533
await proc.communicate()

tox.ini

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[tox]
2-
envlist = py35, py36, py37
3-
minversion = 2.5.0
2+
minversion = 3.14.0
3+
envlist = py35, py36, py37, py38
4+
skip_missing_interpreters = true
45

56
[testenv]
67
extras = testing

0 commit comments

Comments
 (0)