Skip to content

Commit 5a219b6

Browse files
author
Arun Persaud
committed
tests: added a doc string and a comment on why we skip the windows platform for an assert at the moment
1 parent 4053880 commit 5a219b6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/integration/test_dev_server_serve.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@
1414
from .dev_server_test_helper import MyFakeSite, SERVER_ADDRESS, find_unused_port, LOGGER, OUTPUT_FOLDER
1515

1616

17-
def test_server_on_used_port(site_and_base_path: Tuple[MyFakeSite, str]):
17+
def test_server_on_used_port(site_and_base_path: Tuple[MyFakeSite, str]) -> None:
18+
"""Check error if port for nikola serve is already being used.
19+
20+
`nikola serve` uses a default port and if that port is already in use it should print out a nice
21+
error message that tells the user what happend and how to fix this.
22+
23+
To test the case where the port is already in use, we open a socket on the same port that we use
24+
for `nikola serve` before starting the server.
25+
26+
The program should exit with a return code of 3 in this case and print out a message to the user.
27+
"""
28+
1829
site, base_path = site_and_base_path
30+
site.show_tracebacks = False
1931
command_serve = serve.CommandServe()
2032
command_serve.set_site(site)
2133
command_serve.serve_pidfile = "there is no file with this name we hope"
@@ -42,7 +54,8 @@ def test_server_on_used_port(site_and_base_path: Tuple[MyFakeSite, str]):
4254
result = future_to_run_web_server.result()
4355
assert 3 == result
4456

45-
57+
# TODO: check if this works on windows
58+
# for now we skip this assert on windows platforms.
4659
if not sys.platform == 'win32':
4760
assert re.match(
4861
r"Port address \d+ already in use, "

0 commit comments

Comments
 (0)