コード例 #1
0
ファイル: test_cli.py プロジェクト: alexdelin/shorthand
def test_stamp_call(capfd, caplog):
    _ = setup_environment()
    _ = cli_stamp_notes(ORIGINAL_CONFIG)
    # Validate stdout
    captured = capfd.readouterr()
    old_line_count, new_line_count, file_count = 0, 0, 0
    for line in captured.out.split('\n'):
        if '(old):' in line:
            old_line_count += 1
        if '(new):' in line:
            new_line_count += 1
        if line.startswith('<<--') and line.endswith('-->>'):
            file_count += 1
    assert new_line_count == old_line_count
    assert file_count == 4

    # Validate that we only get DEBUG and INFO log messages
    for record in caplog.records:
        assert record.levelname in ['DEBUG', 'INFO']

    teardown_environment()
コード例 #2
0
ファイル: test_stamping.py プロジェクト: alexdelin/shorthand
 def teardown_class(self):
     '''Ensure that we don't leave stamped
     notes around after the tests are run
     '''
     teardown_environment()