wepoll 0.1.5__tar.gz → 0.2.0__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.
Files changed (28) hide show
  1. {wepoll-0.1.5 → wepoll-0.2.0}/PKG-INFO +2 -2
  2. {wepoll-0.1.5 → wepoll-0.2.0}/pyproject.toml +8 -2
  3. {wepoll-0.1.5 → wepoll-0.2.0}/setup.py +1 -3
  4. {wepoll-0.1.5 → wepoll-0.2.0}/tests/test_wepoll_cyares.py +12 -11
  5. {wepoll-0.1.5 → wepoll-0.2.0}/tests/test_wepoll_eventloop.py +9 -8
  6. wepoll-0.2.0/tests/test_wepoll_selectors.py +47 -0
  7. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/__init__.py +1 -2
  8. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/_wepoll.c +1802 -1799
  9. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/_wepoll.pxd +1 -1
  10. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/_wepoll.pyi +2 -3
  11. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/_wepoll.pyx +14 -3
  12. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/msvc_compat.h +8 -0
  13. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/selector.py +18 -16
  14. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll.egg-info/PKG-INFO +2 -2
  15. wepoll-0.1.5/tests/test_wepoll_selectors.py +0 -25
  16. {wepoll-0.1.5 → wepoll-0.2.0}/MANIFEST.in +0 -0
  17. {wepoll-0.1.5 → wepoll-0.2.0}/README.md +0 -0
  18. {wepoll-0.1.5 → wepoll-0.2.0}/setup.cfg +0 -0
  19. {wepoll-0.1.5 → wepoll-0.2.0}/vendor/wepoll/wepoll.c +0 -0
  20. {wepoll-0.1.5 → wepoll-0.2.0}/vendor/wepoll/wepoll.h +0 -0
  21. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/__init__.pxd +0 -0
  22. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/flags.py +0 -0
  23. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/loop.py +0 -0
  24. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll/socket.pxd +0 -0
  25. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll.egg-info/SOURCES.txt +0 -0
  26. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll.egg-info/dependency_links.txt +0 -0
  27. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll.egg-info/not-zip-safe +0 -0
  28. {wepoll-0.1.5 → wepoll-0.2.0}/wepoll.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wepoll
3
- Version: 0.1.5
3
+ Version: 0.2.0
4
4
  Summary: Cython adaptation of the wepoll C Library providing epoll selectors to windows
5
5
  Author-email: Vizonex <VizonexBusiness@gmail.com>
6
- License: MIT License
6
+ License-Expression: MIT
7
7
  Project-URL: homepage, https://github.com/Vizonex/pywepoll
8
8
  Project-URL: repository, https://github.com/Vizonex/pywepoll.git
9
9
  Requires-Python: >=3.10
@@ -1,20 +1,26 @@
1
1
  [project]
2
2
  name = "wepoll"
3
3
  description = "Cython adaptation of the wepoll C Library providing epoll selectors to windows"
4
- version = "0.1.5"
4
+ dynamic = ["version"]
5
5
  authors = [
6
6
  { name = "Vizonex", email = "VizonexBusiness@gmail.com" }
7
7
  ]
8
8
  readme = "README.md"
9
- license = {text = "MIT License"}
9
+ license = "MIT"
10
10
  requires-python = ">=3.10"
11
11
  dependencies = []
12
12
 
13
13
  [tool.cibuildwheel]
14
14
  build-frontend = "build"
15
15
 
16
+ [tool.setuptools.dynamic]
17
+ version = {attr = "wepoll.__version__"}
18
+
19
+
16
20
  [build-system]
17
21
  requires = ["setuptools", "cython", "wheel"]
22
+ build-backend = "setuptools.build_meta"
23
+
18
24
 
19
25
  [tool.setuptools]
20
26
  zip-safe = false
@@ -1,8 +1,7 @@
1
1
  from Cython.Build import cythonize
2
2
  from setuptools import Extension, setup
3
3
 
4
-
5
- # TODO: Move to pyproject.toml setup like in pyduktape3 in 0.1.6
4
+ # TODO: Move to pyproject.toml setup like in pyduktape3 somewhere around 0.3.0
6
5
  setup(
7
6
  ext_modules=cythonize(
8
7
  [
@@ -15,4 +14,3 @@ setup(
15
14
  ]
16
15
  )
17
16
  )
18
-
@@ -1,15 +1,20 @@
1
- from cyares import Channel
2
- from cyares.channel import CYARES_SOCKET_BAD
3
- from wepoll import EpollSelector
4
1
  from wepoll import epoll, EPOLLIN, EPOLLOUT
5
2
  from socket import AF_INET
6
- READ = EPOLLIN
7
- WRITE = EPOLLOUT
3
+ import pytest
4
+
8
5
 
6
+ cyares = pytest.importorskip("cyares")
7
+ if cyares is not None:
8
+ from cyares import Channel
9
+ from cyares.channel import CYARES_SOCKET_BAD
9
10
  # based off pycares's testsuite
10
11
 
12
+ READ = EPOLLIN
13
+ WRITE = EPOLLOUT
14
+
11
15
  class TestCyaresWepoll:
12
- channel: Channel
16
+ channel: "Channel"
17
+
13
18
  def wait(self):
14
19
  # The function were really testing is this wait function
15
20
  poll = epoll()
@@ -24,9 +29,7 @@ class TestCyaresWepoll:
24
29
 
25
30
  timeout = self.channel.timeout()
26
31
  if timeout == 0.0:
27
- self.channel.process_fd(
28
- CYARES_SOCKET_BAD, CYARES_SOCKET_BAD
29
- )
32
+ self.channel.process_fd(CYARES_SOCKET_BAD, CYARES_SOCKET_BAD)
30
33
  continue
31
34
  for fd, event in poll.poll(timeout):
32
35
  if event & ~EPOLLIN:
@@ -40,5 +43,3 @@ class TestCyaresWepoll:
40
43
  self.wait()
41
44
  self.channel.cancel()
42
45
  assert fut.result()
43
-
44
-
@@ -2,18 +2,19 @@ from wepoll import WepollEventLoop
2
2
  from cyares.aio import DNSResolver
3
3
  import pytest
4
4
 
5
- import anyio
6
-
7
-
8
5
  @pytest.fixture(
9
- params=[pytest.param(("asyncio", {"loop_factory": WepollEventLoop}), id="asyncio[WepollEventLoop]")]
6
+ params=[
7
+ pytest.param(
8
+ ("asyncio", {"loop_factory": WepollEventLoop}),
9
+ id="asyncio[WepollEventLoop]",
10
+ )
11
+ ]
10
12
  )
11
13
  def anyio_backend(request: pytest.FixtureRequest):
12
14
  return request.param
13
15
 
16
+
14
17
  @pytest.mark.anyio
15
- async def test_dns_resolver_over_wepoll(anyio_backend):
18
+ async def test_dns_resolver_over_wepoll() -> None:
16
19
  async with DNSResolver(["8.8.8.8", "8.8.4.4"], event_thread=False) as dns:
17
- assert await dns.query("google.com", "A")
18
-
19
-
20
+ assert await dns.query("google.com", "A")
@@ -0,0 +1,47 @@
1
+ import selectors
2
+ import tempfile
3
+ import unittest
4
+ from test.test_selectors import ScalableSelectorMixIn, BaseSelectorTestCase
5
+ from wepoll import EpollSelector
6
+
7
+ # Code is borrowed from python's testsuite to ensure wepoll matches up with unix epolls
8
+
9
+
10
+ class EpollSelectorTestCase(
11
+ BaseSelectorTestCase, ScalableSelectorMixIn, unittest.TestCase
12
+ ):
13
+ SELECTOR = EpollSelector
14
+
15
+ def test_modify_unregister(self):
16
+ if self.SELECTOR.__name__ == "EpollSelector":
17
+ patch = unittest.mock.patch("wepoll.EpollSelector._selector_cls")
18
+ else:
19
+ raise self.skipTest("")
20
+
21
+ with patch as m:
22
+ m.return_value.modify = unittest.mock.Mock(side_effect=ZeroDivisionError)
23
+ s = self.SELECTOR()
24
+ self.addCleanup(s.close)
25
+ rd, wr = self.make_socketpair()
26
+ s.register(rd, selectors.EVENT_READ)
27
+ self.assertEqual(len(s._map), 1)
28
+ with self.assertRaises(ZeroDivisionError):
29
+ s.modify(rd, selectors.EVENT_WRITE)
30
+ self.assertEqual(len(s._map), 0)
31
+
32
+ def test_register_file(self):
33
+ # epoll(7) returns EPERM when given a file to watch
34
+ s = self.SELECTOR()
35
+ with tempfile.NamedTemporaryFile() as f:
36
+ with self.assertRaises(IOError):
37
+ s.register(f, selectors.EVENT_READ)
38
+ # the SelectorKey has been removed
39
+ with self.assertRaises(KeyError):
40
+ s.get_key(f)
41
+
42
+ def test_empty_select(self):
43
+ # Issue #23009: Make sure EpollSelector.select() works when no FD is
44
+ # registered.
45
+ s = self.SELECTOR()
46
+ self.addCleanup(s.close)
47
+ self.assertEqual(s.select(timeout=0), [])
@@ -15,7 +15,7 @@ from .loop import WepollEventLoop
15
15
  from .selector import EpollSelector
16
16
 
17
17
  __author__ = "Vizonex"
18
- __version__ = "0.1.5"
18
+ __version__ = "0.2.0"
19
19
  __all__ = (
20
20
  "EPOLLERR",
21
21
  "EPOLLHUP",
@@ -33,4 +33,3 @@ __all__ = (
33
33
  "__version__",
34
34
  "epoll",
35
35
  )
36
-