From 3b6aa4658fa868e160570be77b1a58c610192b0a Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 20 Apr 2016 14:03:01 +0900 Subject: [PATCH] Bug 1266343 - Use an empty mozconfig from the source directory. r=chmanchester When configure unit tests use an empty mozconfig, instead of creating an empty temporary file, use an empty mozconfig from the source directory. --- python/mozbuild/mozbuild/test/configure/common.py | 13 +++++++++---- .../mozbuild/test/configure/data/empty_mozconfig | 0 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 python/mozbuild/mozbuild/test/configure/data/empty_mozconfig diff --git a/python/mozbuild/mozbuild/test/configure/common.py b/python/mozbuild/mozbuild/test/configure/common.py index bc4c539d9983..6c90134d9a2c 100644 --- a/python/mozbuild/mozbuild/test/configure/common.py +++ b/python/mozbuild/mozbuild/test/configure/common.py @@ -170,9 +170,13 @@ class BaseConfigureTest(unittest.TestCase): if not out: out = StringIO() - fh, mozconfig_path = tempfile.mkstemp() - os.write(fh, mozconfig) - os.close(fh) + if mozconfig: + fh, mozconfig_path = tempfile.mkstemp() + os.write(fh, mozconfig) + os.close(fh) + else: + mozconfig_path = os.path.join(os.path.dirname(__file__), 'data', + 'empty_mozconfig') try: environ = dict( @@ -192,4 +196,5 @@ class BaseConfigureTest(unittest.TestCase): return sandbox finally: - os.remove(mozconfig_path) + if mozconfig: + os.remove(mozconfig_path) diff --git a/python/mozbuild/mozbuild/test/configure/data/empty_mozconfig b/python/mozbuild/mozbuild/test/configure/data/empty_mozconfig new file mode 100644 index 000000000000..e69de29bb2d1