예제 #1
0
def test_execute_process_prefix_filter_no_match():
    lc = LaunchContext()
    lc._set_asyncio_loop(asyncio.get_event_loop())
    SetLaunchConfiguration('launch-prefix', 'time').visit(lc)
    assert len(lc.launch_configurations) == 1
    SetLaunchConfiguration('launch-prefix-filter', 'no-match').visit(lc)
    assert len(lc.launch_configurations) == 2

    test_process = ExecuteProcess(
        cmd=[sys.executable, '-c', "print('action')"], output='screen')

    test_process.execute(lc)
    assert 'time' not in test_process.process_details['cmd']
def test_launch_context_get_set_asyncio_loop():
    """Test the getting and settings for asyncio_loop in the LaunchContext class."""
    lc = LaunchContext()
    assert lc.asyncio_loop is None
    lc._set_asyncio_loop(asyncio.get_event_loop())
    assert lc.asyncio_loop == asyncio.get_event_loop()