def test_read_nonexistring_calendar(capsys): sch = Scheduler() with pytest.raises(Exception) as excinfo: sch.read_calendar(file='non_existring_file.extension') cp = capsys.readouterr() assert not cp.out assert 'No such file or directory:' in str(excinfo.value)
def test_read_empty_calendar(capsys): sch = Scheduler() with pytest.raises(Exception) as excinfo: sch.read_calendar(file='tests/empty.ics') cp = capsys.readouterr() assert not cp.out assert 'Multiple calendars in one file are not supported by this method.' in str( excinfo.value)