From e596d2313761ce0c93f2f6d379344aa22620b06b Mon Sep 17 00:00:00 2001 From: Alexander Sidorov Date: Fri, 14 Dec 2018 16:20:37 -0800 Subject: [PATCH] Start unittesting our main observer (#15191) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15191 OSS: just splitting out basic flags from a unit test. So I can extend them in another test where I need to add additional flags. Reviewed By: yinghai Differential Revision: D13159184 fbshipit-source-id: 9823e792cf0ed8d0379235c44564862b7d784845 --- caffe2/python/test_util.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/caffe2/python/test_util.py b/caffe2/python/test_util.py index 947975f..1bebe50 100644 --- a/caffe2/python/test_util.py +++ b/caffe2/python/test_util.py @@ -42,15 +42,19 @@ def str_compare(a, b, encoding="utf8"): return a == b +def get_default_test_flags(): + return [ + 'caffe2', + '--caffe2_log_level=0', + '--caffe2_cpu_allocator_do_zero_fill=0', + '--caffe2_cpu_allocator_do_junk_fill=1', + ] + + class TestCase(unittest.TestCase): @classmethod def setUpClass(cls): - workspace.GlobalInit([ - 'caffe2', - '--caffe2_log_level=0', - '--caffe2_cpu_allocator_do_zero_fill=0', - '--caffe2_cpu_allocator_do_junk_fill=1', - ]) + workspace.GlobalInit(get_default_test_flags()) # clear the default engines settings to separate out its # affect from the ops tests core.SetEnginePref({}, {}) -- 2.7.4