Skip to content

Commit

Permalink
Make tests executable again.
Browse files Browse the repository at this point in the history
  • Loading branch information
kofrezo committed Nov 11, 2024
1 parent fc9c1c0 commit d6e1a8f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
Empty file added .github/tests.yml
Empty file.
15 changes: 15 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Copyright (c) 2006 Guillaume Chazarain <[email protected]>
Copyright (c) 2024 InnoGames GmbH
"""
import pexpect
from pexpect.popen_spawn import PopenSpawn


# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
Expand All @@ -15,3 +19,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

def launch_polysh(args, input_data=None):
args = ['uv', 'run', 'polysh'] + args

if input_data is None:
child = pexpect.spawn(args[0], args=args[1:], encoding='utf-8')
else:
child = PopenSpawn(args)
child.send(input_data)
child.sendeof()
return child
2 changes: 2 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

from time import sleep

from tests import launch_polysh


class TestBasic(unittest.TestCase):
def localhost(self, nr_localhost):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pexpect
import os

from polysh_tests import launch_polysh
from tests import launch_polysh


class TestCommandLine(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_control_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import os
import unittest
import pexpect
from polysh_tests import launch_polysh

from tests import launch_polysh


class TestControlCommands(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_display_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import unittest
import pexpect
from polysh_tests import launch_polysh

from tests import launch_polysh


class TestDisplayNames(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_host_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import unittest
import pexpect
from polysh_tests import launch_polysh

from tests import launch_polysh


class TestHostSyntax(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_non_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import unittest
import pexpect
from polysh_tests import launch_polysh

from tests import launch_polysh


class TestNonInteractive(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_password_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import os
import unittest
import pexpect
from polysh_tests import launch_polysh

from tests import launch_polysh

SSH_ARG = """--ssh=bash -c '
read -p password: -s PASSWD;
Expand Down

0 comments on commit d6e1a8f

Please sign in to comment.