# Path: cli_bdd/behave/steps/command.py

# 
# Path: cli_bdd/core/steps/command.py
# def run(command, fail_on_error=False, interactively=False, timeout=30):
# def ensure_command_finished(child):
#     def step(self, command, timeout):
#     def step(self, command):
#     def step(self, command):
#     def step(self, input_):
#     def step(self, dialog_matcher, timeout):
#     def step(self, output, should_not=False, exactly=False):
#     def step(self, output, should_not=False, comparison=None, count=None):
#     def step(self, should_not=False, exit_status=None):
# class RunCommand(StepBase):
# class SuccessfullyRunCommand(StepBase):
# class RunCommandInteractively(StepBase):
# class TypeIntoCommand(StepBase):
# class GotInteractiveDialogCommand(StepBase):
# class OutputShouldContainText(StepBase):
# class OutputShouldContainLines(StepBase):
# class ExitStatusShouldBe(StepBase):
# 
# Path: cli_bdd/lettuce/steps/command.py



import os
import tempfile
import pexpect
from hamcrest import assert_that, equal_to
from cli_bdd.behave.steps import command as behave_command
from cli_bdd.core.steps.command import base_steps
from cli_bdd.lettuce.steps import command as lettuce_command
from testutils import (
    BehaveStepsTestMixin,
    LettuceStepsTestMixin,
    StepsSentenceRegexTestMixin,
    TestCase
)
            'run_command_interactively',
            kwargs={
                'command': 'rm -i %s' % file_path,
            }
        )

        # file should not be removed yet
        assert_that(os.path.isfile(file_path), equal_to(True))

        # let's communicate and say Yes via step
        self.execute_module_step(
            'type_into_command',
            context=context,
            kwargs={
                'input_': 'Y',
            }
        )
        context.command_response['child'].expect(pexpect.EOF)

        # file should be removed
        assert_that(os.path.isfile(file_path), equal_to(False))

    def test_got_interactive_dialog(self):
        file_path = os.path.join(tempfile.gettempdir(), 'test_interactive.txt')
        with open(file_path, 'wr') as ff:
            ff.write('Some text')

        for matcher, valid in (
            ('remove test_interactive.txt', False),
            ('remove .*/test_interactive.txt', True)

# Path: cli_bdd/behave/steps/command.py

# 
# Path: cli_bdd/core/steps/command.py
# def run(command, fail_on_error=False, interactively=False, timeout=30):
# def ensure_command_finished(child):
#     def step(self, command, timeout):
#     def step(self, command):
#     def step(self, command):
#     def step(self, input_):
#     def step(self, dialog_matcher, timeout):
#     def step(self, output, should_not=False, exactly=False):
#     def step(self, output, should_not=False, comparison=None, count=None):
#     def step(self, should_not=False, exit_status=None):
# class RunCommand(StepBase):
# class SuccessfullyRunCommand(StepBase):
# class RunCommandInteractively(StepBase):
# class TypeIntoCommand(StepBase):
# class GotInteractiveDialogCommand(StepBase):
# class OutputShouldContainText(StepBase):
# class OutputShouldContainLines(StepBase):
# class ExitStatusShouldBe(StepBase):
# 
# Path: cli_bdd/lettuce/steps/command.py



# Path: tests/unit/steps/command/tests.py
import os
import tempfile
import pexpect
from hamcrest import assert_that, equal_to
from cli_bdd.behave.steps import command as behave_command
from cli_bdd.core.steps.command import base_steps
from cli_bdd.lettuce.steps import command as lettuce_command
from testutils import (
    BehaveStepsTestMixin,
    LettuceStepsTestMixin,
    StepsSentenceRegexTestMixin,
    TestCase
)

            'run_command_interactively',
            kwargs={
                'command': 'rm -i %s' % file_path,
            }
        )

        # file should not be removed yet
        assert_that(os.path.isfile(file_path), equal_to(True))

        # let's communicate and say Yes via step
        self.execute_module_step(
            'type_into_command',
            context=context,
            kwargs={
                'input_': 'Y',
            }
        )
        context.command_response['child'].expect(pexpect.EOF)

        # file should be removed
        assert_that(os.path.isfile(file_path), equal_to(False))

    def test_got_interactive_dialog(self):
        file_path = os.path.join(tempfile.gettempdir(), 'test_interactive.txt')
        with open(file_path, 'wr') as ff:
            ff.write('Some text')

        for matcher, valid in (
            ('remove test_interactive.txt', False),
            ('remove .*/test_interactive.txt', True)

        ):