Commit 76d242b3 authored by Vadim Mazaev's avatar Vadim Mazaev

fix linesep for windows

parent 21d58c4c
......@@ -3,6 +3,7 @@ import io
from collections import Counter
from pathlib import Path
import typing as tp
import os
import pytest
from _pytest.capture import CaptureFixture # typing
......@@ -49,7 +50,7 @@ def test_tail(case: Case, tmp_path: Path) -> None:
output = io.BytesIO()
tail(test_file, lines_amount=case.lines, output=output)
answer = output.getvalue().decode().split('\n')[:-1]
answer = output.getvalue().decode().split(os.linesep)[:-1]
assert case.result == answer
......@@ -59,7 +60,7 @@ def test_real_log_file() -> None:
output = io.BytesIO()
tail(log_file, lines_amount=100, output=output)
answer = output.getvalue().decode().split('\n')[:-1]
answer = output.getvalue().decode().split(os.linesep)[:-1]
ips = Counter(line.split()[3] for line in answer)
handles = Counter(line.split()[5] for line in answer)
......@@ -85,7 +86,7 @@ def test_stdout_by_default(capsys: CaptureFixture) -> None:
last_line = '[28/Sep/2019:15:57:03 +0000] py.manytask.org 91.228.178.70 "GET / HTTP/1.1" 200 0.130 8337 "0.128"'
tail(log_file, lines_amount=10)
answer = capsys.readouterr().out.split('\n')[:-1]
answer = capsys.readouterr().out.split(os.linesep)[:-1]
assert len(answer) == 10
assert answer[-1] == last_line
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment