From 1e6213e5fdff5f8146c00af8a76cb1ebf68fcac5 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 15 Oct 2014 12:41:31 -0700 Subject: Test failure to parse config file when bcfg2.conf exists --- testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py | 4 +++- testsuite/Testsrc/Testlib/TestOptions/__init__.py | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'testsuite/Testsrc/Testlib') diff --git a/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py b/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py index aee2ff666..78acadf1f 100644 --- a/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py +++ b/testsuite/Testsrc/Testlib/TestOptions/TestConfigFiles.py @@ -2,9 +2,10 @@ import argparse +import mock + from Bcfg2.Options import Option, PathOption, ConfigFileAction, get_parser, \ new_parser - from testsuite.Testsrc.Testlib.TestOptions import make_config, OptionTestCase @@ -43,6 +44,7 @@ class TestConfigFiles(OptionTestCase): inner1() + @mock.patch("os.path.exists", mock.Mock(return_value=False)) def test_no_config_file(self): """fail to read config file.""" self.assertRaises(SystemExit, self.parser.parse, []) diff --git a/testsuite/Testsrc/Testlib/TestOptions/__init__.py b/testsuite/Testsrc/Testlib/TestOptions/__init__.py index b051f65e5..00e250356 100644 --- a/testsuite/Testsrc/Testlib/TestOptions/__init__.py +++ b/testsuite/Testsrc/Testlib/TestOptions/__init__.py @@ -77,9 +77,3 @@ class OptionTestCase(Bcfg2TestCase): @classmethod def tearDownClass(cls): Parser.unit_test = True - - - -# TODO: -# * subcommands -# * common options -- cgit v1.2.3-1-g7c22