async-solipsism 0.6__tar.gz → 0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {async-solipsism-0.6 → async_solipsism-0.7}/.github/workflows/test.yml +2 -1
- {async-solipsism-0.6 → async_solipsism-0.7}/PKG-INFO +20 -3
- {async-solipsism-0.6 → async_solipsism-0.7}/README.md +18 -1
- {async-solipsism-0.6 → async_solipsism-0.7}/pyproject.toml +1 -1
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism/__init__.py +1 -1
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism/loop.py +37 -2
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism/socket.py +1 -1
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism.egg-info/PKG-INFO +20 -3
- {async-solipsism-0.6 → async_solipsism-0.7}/.flake8 +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/.gitignore +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/.pre-commit-config.yaml +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/LICENSE +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/pytest.ini +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/requirements.in +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/requirements.txt +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/setup.cfg +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/setup.py +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism/clock.py +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism/exceptions.py +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism/selector.py +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism.egg-info/SOURCES.txt +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism.egg-info/dependency_links.txt +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism.egg-info/requires.txt +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism.egg-info/top_level.txt +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/test/test_loop.py +0 -0
- {async-solipsism-0.6 → async_solipsism-0.7}/test/test_socket.py +0 -0
|
@@ -20,13 +20,14 @@ jobs:
|
|
|
20
20
|
runs-on: ubuntu-22.04
|
|
21
21
|
strategy:
|
|
22
22
|
matrix:
|
|
23
|
-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
23
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
24
24
|
steps:
|
|
25
25
|
- uses: actions/checkout@v4
|
|
26
26
|
- name: Set up Python ${{ matrix.python-version }}
|
|
27
27
|
uses: actions/setup-python@v5
|
|
28
28
|
with:
|
|
29
29
|
python-version: ${{ matrix.python-version }}
|
|
30
|
+
allow-prereleases: true
|
|
30
31
|
- name: Install dependencies
|
|
31
32
|
run: pip install -r requirements.txt
|
|
32
33
|
- name: Install package
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: async-solipsism
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Summary: Asyncio event loop that doesn't interact with the outside world
|
|
5
5
|
Author-email: Bruce Merry <bmerry@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/bmerry/async-solipsism
|
|
7
|
-
Classifier: Development Status ::
|
|
7
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
8
8
|
Classifier: Framework :: AsyncIO
|
|
9
9
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
10
10
|
Classifier: Topic :: Software Development :: Testing :: Mocking
|
|
@@ -130,7 +130,14 @@ def event_loop():
|
|
|
130
130
|
loop.close()
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
### Integration with
|
|
133
|
+
### Integration with aiohappyeyeballs
|
|
134
|
+
|
|
135
|
+
Unfortunately `aiohappyeyeballs.start_connection` doesn't work out of the box
|
|
136
|
+
because it relies on creating a real socket. I've created a replacement
|
|
137
|
+
`async_solipsism.aiohappyeyeballs_start_connection` that can be used to
|
|
138
|
+
replace it. See the aiohttp section below for example code.
|
|
139
|
+
|
|
140
|
+
### Integration with aiohttp
|
|
134
141
|
|
|
135
142
|
A little extra work is required to work with aiohttp's test utilities, but it
|
|
136
143
|
is possible. The example below requires at least aiohttp 3.8.0.
|
|
@@ -146,6 +153,12 @@ def event_loop_policy():
|
|
|
146
153
|
return async_solipsism.EventLoopPolicy()
|
|
147
154
|
|
|
148
155
|
|
|
156
|
+
@pytest.fixture(autouse=True)
|
|
157
|
+
def mock_start_connection(monkeypatch):
|
|
158
|
+
monkeypatch.setattr("aiohappyeyeballs.start_connection",
|
|
159
|
+
async_solipsism.aiohappyeyeballs_start_connection)
|
|
160
|
+
|
|
161
|
+
|
|
149
162
|
def socket_factory(host, port, family):
|
|
150
163
|
return async_solipsism.ListenSocket((host, port))
|
|
151
164
|
|
|
@@ -193,6 +206,10 @@ Calling functions that are not supported will generally raise
|
|
|
193
206
|
|
|
194
207
|
## Changelog
|
|
195
208
|
|
|
209
|
+
### 0.7
|
|
210
|
+
|
|
211
|
+
- Add a replacement function for `aiohappyeyeballs.start_connection`.
|
|
212
|
+
|
|
196
213
|
### 0.6
|
|
197
214
|
|
|
198
215
|
- Drop support for Python 3.6 and 3.7, which have reached end of life.
|
|
@@ -111,7 +111,14 @@ def event_loop():
|
|
|
111
111
|
loop.close()
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
### Integration with
|
|
114
|
+
### Integration with aiohappyeyeballs
|
|
115
|
+
|
|
116
|
+
Unfortunately `aiohappyeyeballs.start_connection` doesn't work out of the box
|
|
117
|
+
because it relies on creating a real socket. I've created a replacement
|
|
118
|
+
`async_solipsism.aiohappyeyeballs_start_connection` that can be used to
|
|
119
|
+
replace it. See the aiohttp section below for example code.
|
|
120
|
+
|
|
121
|
+
### Integration with aiohttp
|
|
115
122
|
|
|
116
123
|
A little extra work is required to work with aiohttp's test utilities, but it
|
|
117
124
|
is possible. The example below requires at least aiohttp 3.8.0.
|
|
@@ -127,6 +134,12 @@ def event_loop_policy():
|
|
|
127
134
|
return async_solipsism.EventLoopPolicy()
|
|
128
135
|
|
|
129
136
|
|
|
137
|
+
@pytest.fixture(autouse=True)
|
|
138
|
+
def mock_start_connection(monkeypatch):
|
|
139
|
+
monkeypatch.setattr("aiohappyeyeballs.start_connection",
|
|
140
|
+
async_solipsism.aiohappyeyeballs_start_connection)
|
|
141
|
+
|
|
142
|
+
|
|
130
143
|
def socket_factory(host, port, family):
|
|
131
144
|
return async_solipsism.ListenSocket((host, port))
|
|
132
145
|
|
|
@@ -174,6 +187,10 @@ Calling functions that are not supported will generally raise
|
|
|
174
187
|
|
|
175
188
|
## Changelog
|
|
176
189
|
|
|
190
|
+
### 0.7
|
|
191
|
+
|
|
192
|
+
- Add a replacement function for `aiohappyeyeballs.start_connection`.
|
|
193
|
+
|
|
177
194
|
### 0.6
|
|
178
195
|
|
|
179
196
|
- Drop support for Python 3.6 and 3.7, which have reached end of life.
|
|
@@ -11,7 +11,7 @@ authors = [
|
|
|
11
11
|
]
|
|
12
12
|
requires-python = ">=3.8"
|
|
13
13
|
classifiers = [
|
|
14
|
-
"Development Status ::
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
15
|
"Framework :: AsyncIO",
|
|
16
16
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
17
17
|
"Topic :: Software Development :: Testing :: Mocking",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2020, 2022 Bruce Merry
|
|
1
|
+
# Copyright 2020, 2022, 2024 Bruce Merry
|
|
2
2
|
#
|
|
3
3
|
# This file is part of async-solipsism.
|
|
4
4
|
#
|
|
@@ -24,7 +24,7 @@ from . import selector, socket as _socket
|
|
|
24
24
|
from .exceptions import SolipsismError
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
__all__ = ('EventLoop', 'EventLoopPolicy', 'stream_pairs')
|
|
27
|
+
__all__ = ('EventLoop', 'EventLoopPolicy', 'aiohappyeyeballs_start_connection', 'stream_pairs')
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
class EventLoop(asyncio.selector_events.BaseSelectorEventLoop):
|
|
@@ -133,6 +133,27 @@ class EventLoop(asyncio.selector_events.BaseSelectorEventLoop):
|
|
|
133
133
|
**kwargs
|
|
134
134
|
)
|
|
135
135
|
|
|
136
|
+
async def aiohappyeyeballs_start_connection(self,
|
|
137
|
+
addr_infos,
|
|
138
|
+
*,
|
|
139
|
+
local_addr_infos=None,
|
|
140
|
+
happy_eyeballs_delay=None,
|
|
141
|
+
interleave=None):
|
|
142
|
+
for addr_info in addr_infos:
|
|
143
|
+
addr = addr_info[4]
|
|
144
|
+
addr = _socket._normalise_ipv6_sockaddr(addr)
|
|
145
|
+
if addr in self.__listening_sockets:
|
|
146
|
+
listener = self.__listening_sockets[addr]
|
|
147
|
+
if local_addr_infos:
|
|
148
|
+
local_addr_info = local_addr_infos[0]
|
|
149
|
+
else:
|
|
150
|
+
port = self.__next_port
|
|
151
|
+
self.__next_port += 1
|
|
152
|
+
local_addr_info = ('::1', port, 0, 0)
|
|
153
|
+
sock = await listener.make_connection(local_addr_info)
|
|
154
|
+
return sock
|
|
155
|
+
raise ConnectionRefusedError('No socket listening on requested addresses')
|
|
156
|
+
|
|
136
157
|
async def connect_read_pipe(self, protocol_factory, pipe):
|
|
137
158
|
raise SolipsismError("connect_read_pipe is not supported")
|
|
138
159
|
|
|
@@ -207,3 +228,17 @@ async def stream_pairs(capacity=None):
|
|
|
207
228
|
streams1 = await asyncio.open_connection(sock=sock1)
|
|
208
229
|
streams2 = await asyncio.open_connection(sock=sock2)
|
|
209
230
|
return streams1, streams2
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
async def aiohappyeyeballs_start_connection(addr_infos,
|
|
234
|
+
*,
|
|
235
|
+
local_addr_infos=None,
|
|
236
|
+
happy_eyeballs_delay=None,
|
|
237
|
+
interleave=None,
|
|
238
|
+
loop=None):
|
|
239
|
+
if loop is None:
|
|
240
|
+
loop = asyncio.get_running_loop()
|
|
241
|
+
return await loop.aiohappyeyeballs_start_connection(addr_infos,
|
|
242
|
+
local_addr_infos=local_addr_infos,
|
|
243
|
+
happy_eyeballs_delay=happy_eyeballs_delay,
|
|
244
|
+
interleave=interleave)
|
|
@@ -120,7 +120,7 @@ class _SocketBase:
|
|
|
120
120
|
|
|
121
121
|
def setblocking(self, flag):
|
|
122
122
|
if flag:
|
|
123
|
-
raise SolipsismError('Socket only
|
|
123
|
+
raise SolipsismError('Socket only supports non-blocking operation')
|
|
124
124
|
|
|
125
125
|
def setsockopt(self, level, optname, value, optlen=None):
|
|
126
126
|
key = (level, optname)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: async-solipsism
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Summary: Asyncio event loop that doesn't interact with the outside world
|
|
5
5
|
Author-email: Bruce Merry <bmerry@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/bmerry/async-solipsism
|
|
7
|
-
Classifier: Development Status ::
|
|
7
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
8
8
|
Classifier: Framework :: AsyncIO
|
|
9
9
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
10
10
|
Classifier: Topic :: Software Development :: Testing :: Mocking
|
|
@@ -130,7 +130,14 @@ def event_loop():
|
|
|
130
130
|
loop.close()
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
### Integration with
|
|
133
|
+
### Integration with aiohappyeyeballs
|
|
134
|
+
|
|
135
|
+
Unfortunately `aiohappyeyeballs.start_connection` doesn't work out of the box
|
|
136
|
+
because it relies on creating a real socket. I've created a replacement
|
|
137
|
+
`async_solipsism.aiohappyeyeballs_start_connection` that can be used to
|
|
138
|
+
replace it. See the aiohttp section below for example code.
|
|
139
|
+
|
|
140
|
+
### Integration with aiohttp
|
|
134
141
|
|
|
135
142
|
A little extra work is required to work with aiohttp's test utilities, but it
|
|
136
143
|
is possible. The example below requires at least aiohttp 3.8.0.
|
|
@@ -146,6 +153,12 @@ def event_loop_policy():
|
|
|
146
153
|
return async_solipsism.EventLoopPolicy()
|
|
147
154
|
|
|
148
155
|
|
|
156
|
+
@pytest.fixture(autouse=True)
|
|
157
|
+
def mock_start_connection(monkeypatch):
|
|
158
|
+
monkeypatch.setattr("aiohappyeyeballs.start_connection",
|
|
159
|
+
async_solipsism.aiohappyeyeballs_start_connection)
|
|
160
|
+
|
|
161
|
+
|
|
149
162
|
def socket_factory(host, port, family):
|
|
150
163
|
return async_solipsism.ListenSocket((host, port))
|
|
151
164
|
|
|
@@ -193,6 +206,10 @@ Calling functions that are not supported will generally raise
|
|
|
193
206
|
|
|
194
207
|
## Changelog
|
|
195
208
|
|
|
209
|
+
### 0.7
|
|
210
|
+
|
|
211
|
+
- Add a replacement function for `aiohappyeyeballs.start_connection`.
|
|
212
|
+
|
|
196
213
|
### 0.6
|
|
197
214
|
|
|
198
215
|
- Drop support for Python 3.6 and 3.7, which have reached end of life.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{async-solipsism-0.6 → async_solipsism-0.7}/src/async_solipsism.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|