Use argparse mutually_exclusive_group for --config-file and --config-data

This does the same as your solution 😉
This commit is contained in:
sedrubal
2017-05-28 22:59:33 +02:00
parent 4ae829c062
commit 30dfa78923
2 changed files with 12 additions and 12 deletions

View File

@@ -145,8 +145,11 @@ class CommandLineTestCase(unittest.TestCase):
out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
self.assertEqual(out, '')
self.assertRegexpMatches(err, r'^Options --config-file and '
r'--config-data cannot be used')
self.assertRegexpMatches(
err.splitlines()[-1],
r'^yamllint: error: argument -d\/--config-data: '
r'not allowed with argument -c\/--config-file$'
)
def test_run_with_bad_config(self):
sys.stdout, sys.stderr = StringIO(), StringIO()