test_filter.py 743 B

123456789101112131415161718192021222324252627
  1. import subprocess
  2. test_input = '#ident "@(#)$Format:LocalFoodAI_lanfr144:test_filter.py:%an:%ae:%ad:%cn:%ce:%cd:%H:%D:%N$"\n'
  3. # Test smudge
  4. p = subprocess.Popen(
  5. ['python', 'local_tools/git-ident-filter.py', 'smudge', 'app.py'],
  6. stdin=subprocess.PIPE,
  7. stdout=subprocess.PIPE,
  8. stderr=subprocess.PIPE,
  9. text=True
  10. )
  11. out, err = p.communicate(test_input)
  12. print("SMUDGE OUT:", repr(out))
  13. print("SMUDGE ERR:", repr(err))
  14. # Test clean on smudged
  15. p2 = subprocess.Popen(
  16. ['python', 'local_tools/git-ident-filter.py', 'clean'],
  17. stdin=subprocess.PIPE,
  18. stdout=subprocess.PIPE,
  19. stderr=subprocess.PIPE,
  20. text=True
  21. )
  22. out2, err2 = p2.communicate(out)
  23. print("CLEAN OUT: ", repr(out2))
  24. print("CLEAN ERR: ", repr(err2))