Skip to content
Snippets Groups Projects
Commit 4bd79410 authored by Phil Dawson's avatar Phil Dawson
Browse files

testutils/patch.py: Add methods for applying and removing patches

parent 76eb65c4
No related branches found
No related tags found
No related merge requests found
import subprocess
def apply(file, patch):
try:
subprocess.check_output(['patch', file, patch])
except subprocess.CalledProcessError as e:
message = "Patch failed with exit code {}\n Output:\n {}".format(
e.returncode, e.output)
print(message)
raise
def remove(file, patch):
try:
subprocess.check_output(['patch', '--reverse', file, patch])
except subprocess.CalledProcessError as e:
message = "patch --reverse failed with exit code {}\n Output:\n {}".format(
e.returncode, e.output)
print(message)
raise
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment