From fd70986a62afc291d3fbc172dc0c7219dc84d4b7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 5 Jul 2020 21:41:50 -0600 Subject: patman: Add a test that uses gitpython It is convenient to use gitpython to create a real git repo for testing patman's operation. Add a test for this. So far it just checks that patman produces the right number of patches for a branch. Signed-off-by: Simon Glass --- tools/patman/tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/patman/tools.py') diff --git a/tools/patman/tools.py b/tools/patman/tools.py index b50370dfe8..f402b9aab8 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -270,7 +270,7 @@ def ReadFile(fname, binary=True): #(fname, len(data), len(data))) return data -def WriteFile(fname, data): +def WriteFile(fname, data, binary=True): """Write data into a file. Args: @@ -279,7 +279,7 @@ def WriteFile(fname, data): """ #self._out.Info("Write file '%s' size %d (%#0x)" % #(fname, len(data), len(data))) - with open(Filename(fname), 'wb') as fd: + with open(Filename(fname), binary and 'wb' or 'w') as fd: fd.write(data) def GetBytes(byte, size): -- cgit v1.2.3