2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

parser testlib - write_file() argument adjustments

This patch modifies testlib.write_file() to take a directory and a file
name instead of a path and return the joined result for callers to use
if necessary.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
Steve Beattie
2013-10-25 16:24:17 -07:00
parent 744f434a32
commit 037924384f
2 changed files with 13 additions and 17 deletions

View File

@@ -165,10 +165,12 @@ def touch(path):
return os.utime(path, None)
def write_file(path, contents):
'''write contents to path'''
def write_file(directory, file, contents):
'''construct path, write contents to it, and return the constructed path'''
path = os.path.join(directory, file)
with open(path, 'w+') as f:
f.write(contents)
return path
def keep_on_fail(unittest_func):