Skip to content

Commit

Permalink
add test for notified posargs
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Mar 9, 2021
1 parent 95dd742 commit f48be2b
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,23 +345,18 @@ def my_session(session):


def test_notify_with_posargs():
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
cfg = create_mock_config()
manifest = Manifest({}, cfg)

for session in manifest.make_session("my_session", my_session):
manifest.add_session(session)
session = manifest.make_session("my_session", Func(lambda session: None))[0]
manifest.add_session(session)

assert len(manifest) == 1
# delete my_session from the queue
manifest.filter_by_name(())

# Establish idempotency; notifying a session already in the queue no-ops.
manifest.notify("my_session")
assert len(manifest) == 1
assert session.posargs is cfg.posargs
assert manifest.notify("my_session", posargs=["--an-arg"])
assert session.posargs == ["--an-arg"]


def test_notify_error():
Expand Down

0 comments on commit f48be2b

Please sign in to comment.