File: remove-test_cythonized_asgi.py.patch

package info (click to toggle)
python-falcon 4.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,172 kB
  • sloc: python: 33,608; javascript: 92; sh: 50; makefile: 50
file content (181 lines) | stat: -rw-r--r-- 5,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
From: Thomas Goirand <zigo@debian.org>
Date: Wed, 13 Nov 2024 11:22:02 +0100
Subject: remove test_cythonized_asgi.py

Forwarded: not-needed
Last-Update: 2022-08-30
---
 tests/asgi/test_cythonized_asgi.py | 134 -------------------------------------
 tests/test_cython.py               |  22 ------
 2 files changed, 156 deletions(-)
 delete mode 100644 tests/asgi/test_cythonized_asgi.py
 delete mode 100644 tests/test_cython.py

diff --git a/tests/asgi/test_cythonized_asgi.py b/tests/asgi/test_cythonized_asgi.py
deleted file mode 100644
index 06e1da4..0000000
--- a/tests/asgi/test_cythonized_asgi.py
+++ /dev/null
@@ -1,134 +0,0 @@
-import sys
-import time
-
-import pytest
-
-import falcon
-from falcon import testing
-import falcon.asgi
-from falcon.util import is_python_func
-
-try:
-    import pyximport
-
-    pyximport.install()
-except ImportError:
-    pyximport = None
-
-# NOTE(kgriffs): We do this here rather than inside the try block above,
-#   so that we don't mask errors importing _cythonized itself.
-if pyximport:
-    from . import _cythonized  # type: ignore
-
-    _CYTHON_FUNC_TEST_TYPES = [
-        _cythonized.nop_method,
-        _cythonized.nop_method_async,
-        _cythonized.NOPClass.nop_method,
-        _cythonized.NOPClass.nop_method_async,
-        _cythonized.NOPClass().nop_method,
-        _cythonized.NOPClass().nop_method_async,
-    ]
-else:
-    _CYTHON_FUNC_TEST_TYPES = []
-
-pytestmark = pytest.mark.skipif(not pyximport, reason='Cython not installed')
-
-# NOTE(vytas): Cython 3.0+ now correctly marks cythonized coroutines as such,
-#   however, the relevant protocol is only available in Python 3.10+.
-#   See also: https://github.com/cython/cython/pull/3427
-CYTHON_COROUTINE_HINT = sys.version_info >= (3, 10)
-
-
-@pytest.fixture
-def client():
-    return testing.TestClient(falcon.asgi.App())
-
-
-def nop_method(self):
-    pass
-
-
-async def nop_method_async(self):
-    pass
-
-
-class NOPClass:
-    def nop_method(self):
-        pass
-
-    async def nop_method_async(self):
-        pass
-
-
-@pytest.mark.parametrize('func', _CYTHON_FUNC_TEST_TYPES)
-def test_is_cython_func(func):
-    assert not is_python_func(func)
-
-
-@pytest.mark.parametrize(
-    'func',
-    [
-        nop_method,
-        nop_method_async,
-        NOPClass.nop_method,
-        NOPClass.nop_method_async,
-        NOPClass().nop_method,
-        NOPClass().nop_method_async,
-    ],
-)
-def test_not_cython_func(func):
-    assert is_python_func(func)
-
-
-def test_jsonchema_validator(client, util):
-    with util.disable_asgi_non_coroutine_wrapping():
-        if CYTHON_COROUTINE_HINT:
-            client.app.add_route('/', _cythonized.TestResourceWithValidation())
-        else:
-            with pytest.raises(TypeError):
-                client.app.add_route(
-                    '/wowsuchfail', _cythonized.TestResourceWithValidation()
-                )
-            return
-
-    client.simulate_get()
-
-
-def test_scheduled_jobs(client):
-    resource = _cythonized.TestResourceWithScheduledJobs()
-    client.app.add_route('/', resource)
-
-    client.simulate_get()
-    time.sleep(0.5)
-    assert resource.counter['backround:on_get:async'] == 2
-    assert resource.counter['backround:on_get:sync'] == 40
-
-
-def test_scheduled_jobs_type_error(client):
-    client.app.add_route(
-        '/wowsuchfail', _cythonized.TestResourceWithScheduledJobsAsyncRequired()
-    )
-
-    # NOTE(kgriffs): Normally an unhandled exception is translated to a
-    #   500 response, but since jobs aren't supposed to be scheduled until
-    #   we are done sending the response, we treat this as a special case
-    #   and allow the error to propagate out of the server. Masking this kind
-    #   of error would make it especially hard to debug in any case (it will
-    #   be hard enough as it is for the app developer).
-    with pytest.raises(TypeError):
-        client.simulate_get('/wowsuchfail')
-
-
-def test_hooks(client, util):
-    with util.disable_asgi_non_coroutine_wrapping():
-        if CYTHON_COROUTINE_HINT:
-            client.app.add_route('/', _cythonized.TestResourceWithHooks())
-        else:
-            with pytest.raises(TypeError):
-                client.app.add_route('/', _cythonized.TestResourceWithHooks())
-
-            return
-
-    result = client.simulate_get()
-    assert result.headers['x-answer'] == '42'
-    assert result.json == {'answer': 42}
diff --git a/tests/test_cython.py b/tests/test_cython.py
deleted file mode 100644
index a1f6e75..0000000
--- a/tests/test_cython.py
+++ /dev/null
@@ -1,22 +0,0 @@
-import io
-
-import pytest
-
-import falcon
-import falcon.util
-
-
-class TestCythonized:
-    def test_imported_from_c_modules(self, util):
-        if not util.HAS_CYTHON:
-            pytest.skip(reason='Cython not installed')
-
-        assert 'falcon/app.py' not in str(falcon.app)
-
-    def test_stream_has_private_read(self, util):
-        stream = falcon.util.BufferedReader(io.BytesIO().read, 8)
-
-        if util.HAS_CYTHON and falcon.util.IS_64_BITS:
-            assert not hasattr(stream, '_read')
-        else:
-            assert hasattr(stream, '_read')