Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Pin pywinpty version to 1.1.0 #101

Merged
merged 10 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ jobs:
matrix:
os: [ubuntu, windows]
python-version: ["3.6", "3.8", "3.9"]
exclude:
# https://github.com/spyder-ide/pywinpty/issues/134
- os: windows
python-version: "3.9"
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down Expand Up @@ -53,4 +49,4 @@ jobs:
- name: Run basic test on Windows
if: ${{ matrix.os == 'windows' }}
run: |
pytest terminado/tests/basic_test.py::CommonTests::test_basic
pytest -vv
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
long_description_content_type="text/x-rst",
install_requires = [
"ptyprocess;os_name!='nt'",
"pywinpty (>=0.5,<1);os_name=='nt'",
"pywinpty (>=1.1.0);os_name=='nt'",
"tornado (>=4)",
],
extras_require = dict(test=['pytest']),
Expand Down
17 changes: 15 additions & 2 deletions terminado/tests/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import re
import signal
import pytest

# We must set the policy for python >=3.8, see https://www.tornadoweb.org/en/stable/#installation
# Snippet from https://github.com/tornadoweb/tornado/issues/2608#issuecomment-619524992
Expand Down Expand Up @@ -88,7 +89,14 @@ async def get_pid(self):
await self.write_stdin("echo $$\r")
(stdout, extra) = await self.read_stdout()
if os.name == 'nt':
match = re.search(r'echo \$\$\x1b\[0K\r\n(\d+)', stdout)
print(repr(stdout))
match = re.search(r'echo \$\$\\x1b\[71X\\x1b\[71C\\r\\n(\d+)', repr(stdout))
if match is None:
match = re.search(r'echo \$\$ \\r\\n(\d+)', repr(stdout))
if match is None:
match = re.search(
r'echo \$\$ \\r\\n\\x1b\[\?25h\\x1b\[\?25l(\d+)',
repr(stdout))
pid = int(match.groups()[0])
else:
print('stdout=%r, extra=%r' % (stdout, extra))
Expand Down Expand Up @@ -134,13 +142,16 @@ def get_app(self):
shell_command=['bash'],
max_terminals=MAX_TERMS,
)

self.single_tm = SingleTermManager(shell_command=['bash'])

self.unique_tm = UniqueTermManager(
shell_command=['bash'],
max_terminals=MAX_TERMS,
)

named_tm = self.named_tm

class NewTerminalHandler(tornado.web.RequestHandler):
"""Create a new named terminal, return redirect"""
def get(self):
Expand All @@ -154,7 +165,7 @@ def get(self):
(r"/unique", TermSocket, {'term_manager': self.unique_tm})
], debug=True)

test_urls = ('/named/term1', '/unique', '/single')
test_urls = ('/named/term1', '/unique') + (('/single',) if os.name != 'nt' else tuple())

class CommonTests(TermTestCase):
@tornado.testing.gen_test
Expand Down Expand Up @@ -205,6 +216,7 @@ async def test_namespace(self):
self.assertNotEqual(pids[0], pids[3])

@tornado.testing.gen_test
@pytest.mark.skipif(os.name == 'nt', reason='It fails on Windows')
async def test_max_terminals(self):
urls = ["/named/%d" % i for i in range(MAX_TERMS+1)]
tms = await self.get_term_clients(urls[:MAX_TERMS])
Expand All @@ -230,6 +242,7 @@ async def test_unique_processes(self):
self.assertNotEqual(pids[0], pids[1])

@tornado.testing.gen_test
@pytest.mark.skipif(os.name == 'nt', reason='It fails on Windows')
async def test_max_terminals(self):
tms = await self.get_term_clients(['/unique'] * MAX_TERMS)
pids = await self.get_pids(tms)
Expand Down