def test_notify(): manifest = Manifest({}, create_mock_config()) # Define a session. def my_session(session): pass my_session.python = None my_session.venv_backend = None def notified(session): pass notified.python = None notified.venv_backend = None # Add the sessions to the manifest. for session in manifest.make_session("my_session", my_session): manifest.add_session(session) for session in manifest.make_session("notified", notified): manifest.add_session(session) assert len(manifest) == 2 # Filter so only the first session is included in the queue. manifest.filter_by_name(("my_session", )) assert len(manifest) == 1 # Notify the notified session. manifest.notify("notified") assert len(manifest) == 2
def test_notify(): manifest = Manifest({}, mock.sentinel.CONFIG) # Define a session. def my_session(session): pass my_session.python = None def notified(session): pass notified.python = None # Add the sessions to the manifest. for session in manifest.make_session('my_session', my_session): manifest.add_session(session) for session in manifest.make_session('notified', notified): manifest.add_session(session) assert len(manifest) == 2 # Filter so only the first session is included in the queue. manifest.filter_by_name(('my_session', )) assert len(manifest) == 1 # Notify the notified session. manifest.notify('notified') assert len(manifest) == 2
def test_notify(): manifest = Manifest({}, mock.sentinel.CONFIG) # Define a session. def my_session(session): pass my_session.python = None def notified(session): pass notified.python = None # Add the sessions to the manifest. for session in manifest.make_session("my_session", my_session): manifest.add_session(session) for session in manifest.make_session("notified", notified): manifest.add_session(session) assert len(manifest) == 2 # Filter so only the first session is included in the queue. manifest.filter_by_name(("my_session",)) assert len(manifest) == 1 # Notify the notified session. manifest.notify("notified") assert len(manifest) == 2
def test_notify_noop(): manifest = Manifest({}, mock.sentinel.CONFIG) # Define a session and add it to the manifest. def my_session(session): pass for session in manifest.make_session('my_session', my_session): manifest.add_session(session) assert len(manifest) == 1 # Establish idempotency; notifying a session already in the queue no-ops. manifest.notify('my_session') assert len(manifest) == 1
def test_notify_noop(): manifest = Manifest({}, mock.sentinel.CONFIG) # Define a session and add it to the manifest. def my_session(session): pass my_session.python = None for session in manifest.make_session("my_session", my_session): manifest.add_session(session) assert len(manifest) == 1 # Establish idempotency; notifying a session already in the queue no-ops. manifest.notify("my_session") assert len(manifest) == 1
def test_notify_noop(): manifest = Manifest({}, create_mock_config()) # Define a session and add it to the manifest. def my_session(session): pass my_session.python = None my_session.venv_backend = None for session in manifest.make_session("my_session", my_session): manifest.add_session(session) assert len(manifest) == 1 # Establish idempotency; notifying a session already in the queue no-ops. manifest.notify("my_session") assert len(manifest) == 1
def test_notify_with_posargs(): cfg = create_mock_config() manifest = Manifest({}, cfg) session = manifest.make_session("my_session", Func(lambda session: None))[0] manifest.add_session(session) # delete my_session from the queue manifest.filter_by_name(()) assert session.posargs == cfg.posargs assert manifest.notify("my_session", posargs=["--an-arg"]) assert session.posargs == ["--an-arg"]
def test_notify_error(): manifest = Manifest({}, mock.sentinel.CONFIG) with pytest.raises(ValueError): manifest.notify("does_not_exist")
def test_notify_error(): manifest = Manifest({}, create_mock_config()) with pytest.raises(ValueError): manifest.notify("does_not_exist")