File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ Changelog
6
6
Upcoming release
7
7
-----------------
8
8
9
+ - Allow live server to handle concurrent requests (`#56 `_), thanks to
10
+ `@mattwbarry `_ for the PR.
11
+
9
12
- Fix broken link to pytest documentation (`#50 `_), thanks to
10
13
`@jineshpaloor `_ for the PR.
11
14
@@ -21,8 +24,10 @@ Upcoming release
21
24
.. _#43 : https://github.com/vitalk/pytest-flask/issues/43
22
25
.. _#48 : https://github.com/pytest-dev/pytest-flask/pull/48
23
26
.. _#50 : https://github.com/pytest-dev/pytest-flask/pull/50
27
+ .. _#56 : https://github.com/pytest-dev/pytest-flask/pull/56
24
28
.. _@danstender : https://github.com/danstender
25
29
.. _@jineshpaloor : https://github.com/jineshpaloor
30
+ .. _@mattwbarry : https://github.com/mattwbarry
26
31
.. _@steenzout : https://github.com/steenzout
27
32
28
33
Original file line number Diff line number Diff line change @@ -82,3 +82,33 @@ def new_endpoint():
82
82
result = appdir .runpytest ('-v' , '--no-start-live-server' )
83
83
result .stdout .fnmatch_lines (['*PASSED*' ])
84
84
assert result .ret == 0
85
+
86
+ def test_concurrent_requests_to_live_server (self , appdir ):
87
+ appdir .create_test_module ('''
88
+ import pytest
89
+ try:
90
+ from urllib2 import urlopen
91
+ except ImportError:
92
+ from urllib.request import urlopen
93
+
94
+ from flask import url_for
95
+
96
+ def test_concurrent_requests(live_server):
97
+ @live_server.app.route('/one')
98
+ def one():
99
+ res = urlopen(url_for('two', _external=True))
100
+ return res.read()
101
+
102
+ @live_server.app.route('/two')
103
+ def two():
104
+ return '42'
105
+
106
+ live_server.start()
107
+
108
+ res = urlopen(url_for('one', _external=True))
109
+ assert res.code == 200
110
+ assert b'42' in res.read()
111
+ ''' )
112
+ result = appdir .runpytest ('-v' , '--no-start-live-server' )
113
+ result .stdout .fnmatch_lines (['*PASSED*' ])
114
+ assert result .ret == 0
You can’t perform that action at this time.
0 commit comments