Skip to content

Commit 80d52c2

Browse files
committed
deps: Update the pytest dependency
Fix #12
1 parent 175d47c commit 80d52c2

File tree

11 files changed

+82
-213
lines changed

11 files changed

+82
-213
lines changed

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ generator fixtures.
2121
Changelog
2222
---------
2323

24+
0.7.0 - TBD
25+
* Changed the pytest dependency to be greater than pytest version 7
26+
2427
0.6.0 - 23 October 2021
2528
* Fix bug where it was possible for an async generator fixture to
2629
be cleaned up even if it was never started.

alt_pytest_asyncio/async_converters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def _raise_maybe(func, info):
7373
lineno = func.__code__.co_firstlineno
7474

7575
def raise_error():
76-
__tracebackhide__ = True
7776
if info["cancelled"]:
7877
assert False, f"Took too long to complete: {fle}:{lineno}"
7978
raise info["e"]

alt_pytest_asyncio/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "0.6.0"
1+
VERSION = "0.7.0"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
, python_requires = ">= 3.7"
1818

1919
, install_requires =
20-
[ "pytest >= 3.0.6"
20+
[ "pytest >= 7.0.0"
2121
]
2222

2323
, extras_require =
2424
{ 'tests':
25-
[ 'pytest==6.2.4'
25+
[ 'pytest==7.3.0'
2626
, 'noseOfYeti[black]==2.4.1'
2727
, "nest-asyncio==1.0.0"
2828
]

tests/conftest.py

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -17,81 +17,3 @@ def pytest_ignore_collect(path):
1717
return True
1818
if path.basename == "interrupt_test":
1919
return True
20-
21-
22-
def free_port():
23-
"""
24-
Return an unused port number
25-
"""
26-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
27-
s.bind(("0.0.0.0", 0))
28-
return s.getsockname()[1]
29-
30-
31-
def port_connected(port):
32-
"""
33-
Return whether something is listening on this port
34-
"""
35-
s = socket.socket()
36-
s.settimeout(5)
37-
try:
38-
s.connect(("127.0.0.1", port))
39-
s.close()
40-
return True
41-
except Exception:
42-
return False
43-
44-
45-
@pytest.fixture(scope="session")
46-
def tcp_port():
47-
return free_port()
48-
49-
50-
@pytest.fixture(scope="session", autouse=True)
51-
async def a_sync_generator_fixture(tcp_port, reversing_echo_tcp_server):
52-
try:
53-
yield
54-
finally:
55-
assert port_connected(tcp_port)
56-
57-
58-
@pytest.fixture(scope="session", autouse=True)
59-
async def reversing_echo_tcp_server(tcp_port):
60-
async def start_connection(reader, writer):
61-
while True:
62-
length = await reader.read(1)
63-
if not length:
64-
return
65-
66-
data = await reader.read(struct.unpack("<b", length)[0])
67-
if not data:
68-
return
69-
70-
writer.write(bytes(reversed(data)))
71-
72-
try:
73-
server = await asyncio.start_server(start_connection, "127.0.0.1", tcp_port)
74-
while True:
75-
if port_connected(tcp_port):
76-
break
77-
await asyncio.sleep(0.01)
78-
assert port_connected(tcp_port)
79-
yield server
80-
finally:
81-
server.close()
82-
await server.wait_closed()
83-
84-
85-
@pytest.fixture()
86-
async def tcp_client(tcp_port):
87-
try:
88-
reader, writer = await asyncio.open_connection("127.0.0.1", tcp_port)
89-
90-
async def communicate(s):
91-
bts = struct.pack("<b", len(s)) + s.encode()
92-
writer.write(bts)
93-
return await reader.read(len(s))
94-
95-
yield communicate
96-
finally:
97-
writer.close()
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
==================================== ERRORS ====================================
2-
_______________ ERROR at setup of test_fails_on_fixture_returns ________________
1+
=======* ERRORS =====*
2+
_______* ERROR at setup of test_fails_on_fixture_returns _____*
33
test_fails.py:16: in fixture_returns
44
await one*()
55
test_fails.py:7: in one
66
return await two*()
77
test_fails.py:11: in two
88
raise ValueError*("WAT")
99
E ValueError: WAT
10-
________________ ERROR at setup of test_fails_on_fixture_yields ________________
10+
_______* ERROR at setup of test_fails_on_fixture_yields _____*
1111
test_fails.py:21: in fixture_yields
1212
yield await one*()
1313
test_fails.py:7: in one
1414
return await two*()
1515
test_fails.py:11: in two
1616
raise ValueError*("WAT")
1717
E ValueError: WAT
18-
_________ ERROR at teardown of test_fails_on_fixture_fails_in_finally __________
18+
_______* ERROR at teardown of test_fails_on_fixture_fails_in_finally _____*
1919
test_fails.py:29: in fixture_fails_in_finally
2020
await one*()
2121
test_fails.py:7: in one
2222
return await two*()
2323
test_fails.py:11: in two
2424
raise ValueError*("WAT")
2525
E ValueError: WAT
26-
===* 1 passed, 3 error* in * ===*
26+
=======* 1 passed, 3 error* in * ===*

tests/example_timeouts/expected

Lines changed: 53 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,92 @@
1-
==================================== ERRORS ====================================
2-
________________________ ERROR at teardown of test_one _________________________
1+
=======* ERRORS =====*
2+
_______* ERROR at teardown of test_one ____*
33
*/async_converters.py:*: in raise_error
44
assert False, f"Took too long to complete: {fle}:{lineno}"
5-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:7
6-
E assert False
7-
__________________________ ERROR at setup of test_two __________________________
5+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:8
6+
_______* ERROR at setup of test_two ____*
87
*/async_converters.py:*: in raise_error
98
assert False, f"Took too long to complete: {fle}:{lineno}"
10-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:16
11-
E assert False
12-
_________________________ ERROR at setup of test_three _________________________
9+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:17
10+
_______* ERROR at setup of test_three ____*
1311
*/async_converters.py:*: in raise_error
1412
assert False, f"Took too long to complete: {fle}:{lineno}"
15-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:23
16-
E assert False
17-
_________________________ ERROR at setup of test_four __________________________
13+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:24
14+
_______* ERROR at setup of test_four ____*
1815
*/async_converters.py:*: in raise_error
1916
assert False, f"Took too long to complete: {fle}:{lineno}"
20-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:30
21-
E assert False
22-
_________________________ ERROR at setup of test_five __________________________
17+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:31
18+
_______* ERROR at setup of test_five ____*
2319
*/async_converters.py:*: in raise_error
2420
assert False, f"Took too long to complete: {fle}:{lineno}"
25-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:46
26-
E assert False
27-
__________________________ ERROR at setup of test_six __________________________
21+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:47
22+
_______* ERROR at setup of test_six ____*
2823
*/async_converters.py:*: in raise_error
2924
assert False, f"Took too long to complete: {fle}:{lineno}"
30-
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:5
31-
E assert False
32-
_________________________ ERROR at setup of test_seven _________________________
25+
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:6
26+
_______* ERROR at setup of test_seven ____*
3327
*/async_converters.py:*: in raise_error
3428
assert False, f"Took too long to complete: {fle}:{lineno}"
35-
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:12
36-
E assert False
37-
_______________________ ERROR at teardown of test_seven ________________________
38-
*/async_converters.py:*: in raise_error
39-
assert False, f"Took too long to complete: {fle}:{lineno}"
40-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails.py:37
41-
E assert False
42-
____________________ ERROR at setup of TestAClass.test_one _____________________
43-
*/async_converters.py:*: in raise_error
29+
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:13
30+
_______* ERROR at teardown of test_seven ____*
31+
*/async_converters.py:* in raise_error
4432
assert False, f"Took too long to complete: {fle}:{lineno}"
45-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_method_fixtures.py:8
46-
E assert False
47-
____________________ ERROR at setup of TestAClass.test_two _____________________
33+
E AssertionError: Took too long to complete: */test_fails.py:38
34+
_______* ERROR at setup of TestAClass.test_one ____*
4835
*/async_converters.py:*: in raise_error
4936
assert False, f"Took too long to complete: {fle}:{lineno}"
50-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_method_fixtures.py:14
51-
E assert False
52-
__________________ ERROR at teardown of TestAClass.test_three __________________
37+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_method_fixtures.py:9
38+
_______* ERROR at setup of TestAClass.test_two ____*
5339
*/async_converters.py:*: in raise_error
5440
assert False, f"Took too long to complete: {fle}:{lineno}"
55-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_method_fixtures.py:20
56-
E assert False
57-
________________________ ERROR at teardown of test_one _________________________
41+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_method_fixtures.py:15
42+
_______* ERROR at teardown of TestAClass.test_three ____*
5843
*/async_converters.py:*: in raise_error
5944
assert False, f"Took too long to complete: {fle}:{lineno}"
60-
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:9
61-
E assert False
62-
__________________________ ERROR at setup of test_two __________________________
45+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_method_fixtures.py:21
46+
_______* ERROR at teardown of test_one ____*
6347
*/async_converters.py:*: in raise_error
6448
assert False, f"Took too long to complete: {fle}:{lineno}"
65-
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:17
66-
E assert False
67-
_________________________ ERROR at setup of test_three _________________________
49+
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:10
50+
_______* ERROR at setup of test_two ____*
6851
*/async_converters.py:*: in raise_error
6952
assert False, f"Took too long to complete: {fle}:{lineno}"
70-
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:23
71-
E assert False
72-
_________________________ ERROR at setup of test_four __________________________
53+
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:18
54+
_______* ERROR at setup of test_three ____*
7355
*/async_converters.py:*: in raise_error
7456
assert False, f"Took too long to complete: {fle}:{lineno}"
75-
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:29
76-
E assert False
77-
_________________________ ERROR at setup of test_five __________________________
57+
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:24
58+
_______* ERROR at setup of test_four ____*
7859
*/async_converters.py:*: in raise_error
7960
assert False, f"Took too long to complete: {fle}:{lineno}"
80-
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:43
81-
E assert False
82-
__________________________ ERROR at setup of test_six __________________________
61+
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:30
62+
_______* ERROR at setup of test_five ____*
8363
*/async_converters.py:*: in raise_error
8464
assert False, f"Took too long to complete: {fle}:{lineno}"
85-
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:5
86-
E assert False
87-
_________________________ ERROR at setup of test_seven _________________________
65+
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:44
66+
_______* ERROR at setup of test_six ____*
8867
*/async_converters.py:*: in raise_error
8968
assert False, f"Took too long to complete: {fle}:{lineno}"
90-
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:12
91-
E assert False
92-
_______________________ ERROR at teardown of test_seven ________________________
69+
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:6
70+
_______* ERROR at setup of test_seven ____*
9371
*/async_converters.py:*: in raise_error
9472
assert False, f"Took too long to complete: {fle}:{lineno}"
95-
E AssertionError: Took too long to complete: */example_timeouts*/test_surrounding_pytestmark.py:35
96-
E assert False
97-
=================================== FAILURES ===================================
98-
________________________ test_takes_closest_pytestmark _________________________
73+
E AssertionError: Took too long to complete: */example_timeouts*/conftest.py:13
74+
_______* ERROR at teardown of test_seven ____*
75+
+ Exception Group Traceback (most recent call last):
76+
| exceptiongroup.ExceptionGroup: errors during test teardown (2 sub-exceptions)
77+
+-+---------------- 1 ----------------
78+
| Traceback (most recent call last):
79+
| AssertionError: Took too long to complete: */conftest.py:20
80+
+---------------- 2 ----------------
81+
| Traceback (most recent call last):
82+
| AssertionError: Took too long to complete: */test_surrounding_pytestmark.py:36
83+
+------------------------------------
84+
=======* FAILURES ====*
85+
_______* test_takes_closest_pytestmark ____*
9986
*/async_converters.py:*: in raise_error
10087
assert False, f"Took too long to complete: {fle}:{lineno}"
101-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_tests.py:8
102-
E assert False
103-
______________________ test_takes_pytestmark_on_function2 ______________________
88+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_tests.py:9
89+
_______* test_takes_pytestmark_on_function2 ____*
10490
*/async_converters.py:*: in raise_error
10591
assert False, f"Took too long to complete: {fle}:{lineno}"
106-
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_tests.py:17
107-
E assert False
92+
E AssertionError: Took too long to complete: */example_timeouts*/test_fails_tests.py:18

tests/interrupt_test/expected

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ tests/test_example.py .FFTEST FINALLY
44
THING FINALLY
55

66

7-
=================================== FAILURES ===================================
8-
__________________________ test_bb_shows_failed_tests __________________________
9-
tests/test_example.py:19: in test_bb_shows_failed_tests
7+
=======* FAILURES ====*
8+
_______* test_bb_shows_failed_tests ____*
9+
tests/test_example.py*: in test_bb_shows_failed_tests
1010
assert False, "NOOOOO"
1111
E AssertionError: NOOOOO
12-
E assert False
13-
_________________________ test_cc_shows_timedout_tests _________________________
14-
*/async_converters.py* in raise_error
12+
_______* test_cc_shows_timedout_tests ____*
13+
*/async_converters.py*: in raise_error
1514
assert False, f"Took too long to complete: {fle}:{lineno}"
16-
E AssertionError: Took too long to complete: */test_example.py:22
17-
E assert False
18-
=========================== short test summary info ============================
19-
FAILED tests/test_example.py::test_bb_shows_failed_tests - AssertionError: NO...
20-
FAILED tests/test_example.py::test_cc_shows_timedout_tests - AssertionError: ...
21-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15+
E AssertionError: Took too long to complete: */test_example.py:*
16+
=======* short test summary info ====*
17+
FAILED tests/test_example.py::test_bb_shows_failed_tests - AssertionError: NO*
18+
FAILED tests/test_example.py::test_cc_shows_timedout_tests - AssertionError: *
19+
!!!!!!!!* KeyboardInterrupt !!!!*
2220
*KeyboardInterrupt
2321
(to show a full traceback on KeyboardInterrupt use --full-trace)
24-
========================= 2 failed, 1 passed in * ==========================
22+
=======* 2 failed, 1 passed in * ====*

0 commit comments

Comments
 (0)