def test_install_msg(monkeypatch): """Test results of call to install_msg based on debug level.""" name = 'some-package' pid = 123456 install_msg = 'Installing {0}'.format(name) monkeypatch.setattr(tty, '_debug', 0) assert inst.install_msg(name, pid) == install_msg monkeypatch.setattr(tty, '_debug', 1) assert inst.install_msg(name, pid) == install_msg # Expect the PID to be added at debug level 2 monkeypatch.setattr(tty, '_debug', 2) expected = "{0}: {1}".format(pid, install_msg) assert inst.install_msg(name, pid) == expected
def test_install_msg(): name = 'some-package' pid = 123456 expected = "{0}: Installing {1}".format(pid, name) assert inst.install_msg(name, pid) == expected