Skip to content

Commit 68a7a64

Browse files
committed
Improve clean stop test by checking that we don't stop cleanly with the cmdline option
1 parent ad98425 commit 68a7a64

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/test_live_server.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def test_a(live_server):
6767
result.stdout.fnmatch_lines(['*PASSED*'])
6868
assert result.ret == 0
6969

70-
def test_clean_stop_live_server(self, appdir, monkeypatch):
70+
@pytest.mark.parametrize('clean_stop', [True, False])
71+
def test_clean_stop_live_server(self, appdir, monkeypatch, clean_stop):
7172
"""Ensure the fixture is trying to cleanly stop the server.
7273
7374
Because this is tricky to test, we are checking that the _stop_cleanly() internal
@@ -106,10 +107,14 @@ def index():
106107
assert res.code == 200
107108
assert b'got it' in res.read()
108109
''')
110+
args = [] if clean_stop else ['--no-live-server-clean-stop']
109111
result = appdir.runpytest_inprocess('-v', '--no-start-live-server',
110-
'--live-server-clean-stop')
112+
*args)
111113
result.stdout.fnmatch_lines('*1 passed*')
112-
assert stop_cleanly_result == [True]
114+
if clean_stop:
115+
assert stop_cleanly_result == [True]
116+
else:
117+
assert stop_cleanly_result == []
113118

114119
def test_add_endpoint_to_live_server(self, appdir):
115120
appdir.create_test_module('''

0 commit comments

Comments
 (0)