Skip to content

Commit

Permalink
xfail on some tests with conpty
Browse files Browse the repository at this point in the history
fix backend parameter

add another skip

add another skip

revert changes to test running

remove pytest pin
  • Loading branch information
blink1073 committed Mar 2, 2022
1 parent 5770274 commit 336fe01
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ jobs:
run: conda install -y winpty
- name: Install build/test dependencies
shell: bash -l {0}
run: pip install maturin toml "pytest<7" pytest-lazy-fixture flaky
run: pip install maturin toml pytest pytest-lazy-fixture flaky
- name: Build pywinpty
shell: bash -l {0}
run: maturin develop
- name: Run tests
shell: pwsh
run: python -m pytest -v -x -s
run: python runtests.py
# Enable this to get RDP access to the worker.
# - name: Download
# # if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def run_pytest(extra_args=None):
pytest_args = ['-v', '-x', '-s']
pytest_args = ['-v', '-x']

# Allow user to pass a custom test path to pytest to e.g. run just one test
if extra_args:
Expand Down
11 changes: 11 additions & 0 deletions winpty/tests/test_ptyprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def pty_fixture(request):
def _pty_factory(cmd=None, env=None):
cmd = cmd or 'cmd'
return PtyProcess.spawn(cmd, env=env, backend=backend)
_pty_factory.backend = request.param
return _pty_factory


Expand Down Expand Up @@ -125,19 +126,25 @@ def test_flush(pty_fixture):


def test_intr(pty_fixture):
if pty_fixture.backend == 'ConPTY':
pytest.xfail('Not supported on ConPTY')
pty = pty_fixture(cmd=[sys.executable, 'import time; time.sleep(10)'])
pty.sendintr()
assert pty.wait() != 0


def test_send_control(pty_fixture):
if pty_fixture.backend == 'ConPTY':
pytest.xfail('Not supported on ConPTY')
pty = pty_fixture(cmd=[sys.executable, 'import time; time.sleep(10)'])
pty.sendcontrol('d')
assert pty.wait() != 0


@pytest.mark.skipif(which('cat') is None, reason="Requires cat on the PATH")
def test_send_eof(pty_fixture):
if pty_fixture.backend == 'ConPTY':
pytest.xfail('Not supported on ConPTY')
cat = pty_fixture('cat')
cat.sendeof()
assert cat.wait() == 0
Expand All @@ -151,6 +158,8 @@ def test_isatty(pty_fixture):


def test_wait(pty_fixture):
if pty_fixture.backend == 'ConPTY':
pytest.xfail('Not supported on ConPTY')
pty = pty_fixture(cmd=[sys.executable, '--version'])
assert pty.wait() == 0

Expand Down Expand Up @@ -212,6 +221,8 @@ def test_terminate_force(pty_fixture):


def test_terminate_loop(pty_fixture):
if pty_fixture.backend == 'ConPTY':
pytest.xfail('Not supported on ConPTY')
pty = pty_fixture()
loop = asyncio.SelectorEventLoop()
asyncio.set_event_loop(loop)
Expand Down

0 comments on commit 336fe01

Please sign in to comment.