Skip to content

Commit

Permalink
different tests for windows and not windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pomponchik committed Aug 16, 2024
1 parent dda9ace commit f7e3d5b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/documentation/test_quick_start.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from io import StringIO
import platform
from contextlib import redirect_stdout, redirect_stderr

import suby
import pytest


def test_run_hello_world():
@pytest.mark.skipif(platform.system() == 'Windows', reason='Windows and not windows have different rules of escaping characters.')
def test_run_hello_world_not_windows():
stderr_buffer = StringIO()
stdout_buffer = StringIO()

Expand All @@ -18,3 +21,20 @@ def test_run_hello_world():
assert result.stderr == ''
assert result.returncode == 0
assert not result.killed_by_token


@pytest.mark.skipif(platform.system() != 'Windows', reason='Windows and not windows have different rules of escaping characters.')
def test_run_hello_world_windows():
stderr_buffer = StringIO()
stdout_buffer = StringIO()

with redirect_stdout(stdout_buffer), redirect_stderr(stderr_buffer):
result = suby('python -c "print^(\'hello,world^!\'^)"')

assert stderr_buffer.getvalue() == ''
assert stdout_buffer.getvalue() == 'hello, world!\n'

assert result.stdout == 'hello, world!\n'
assert result.stderr == ''
assert result.returncode == 0
assert not result.killed_by_token

0 comments on commit f7e3d5b

Please sign in to comment.