Skip to content

Commit

Permalink
Workaround for Windows \r\n newlines.
Browse files Browse the repository at this point in the history
  • Loading branch information
aknrdureegaesr committed Dec 19, 2024
1 parent 1c679aa commit 4948953
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/integration/test_dev_server_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,21 @@ def test_serves_root_dir(
res = session.get(server_base_uri)
res.raise_for_status()
assert "text/html; charset=UTF-8" == res.headers['content-type']
assert expected_text in res.text
text_found = res.text.replace("\r\n", "\n") # On windows, the server provides spurious \r
assert expected_text == text_found

assert not base_path.endswith("/")
res2 = session.get(f"{server_root_uri}{base_path}/")
res2.raise_for_status()
assert "text/html; charset=UTF-8" == res2.headers['content-type']
assert expected_text in res2.text
text_found_2 = res2.text.replace("\r\n", "\n")
assert expected_text == text_found_2

res3 = session.get(f"{server_root_uri}{base_path}/index.html")
res3.raise_for_status()
assert "text/html; charset=UTF-8" == res3.headers['content-type']
assert expected_text in res3.text
text_found_3 = res3.text.replace("\r\n", "\n")
assert expected_text in text_found_3

LOGGER.info("Web server access successful with intended result.")
finally:
Expand Down

0 comments on commit 4948953

Please sign in to comment.