def _check_impl_args(self, namespace): assert hasattr(namespace, 'build_script_impl_args') try: migration.check_impl_args(constants.BUILD_SCRIPT_IMPL_PATH, namespace.build_script_impl_args) except (SystemExit, ValueError) as e: raise ParserError('failed to parse impl arguments: {} {}'.format( str(namespace.build_script_impl_args), e))
def test_check_impl_args(self): if platform.system() == 'Windows': self.skipTest("build-script-impl cannot run in Windows") return self.assertIsNone( migration.check_impl_args(BUILD_SCRIPT_IMPL_PATH, ['--reconfigure'])) with self.assertRaises(ValueError) as cm: migration.check_impl_args(BUILD_SCRIPT_IMPL_PATH, ['foo']) self.assertIn('foo', str(cm.exception)) with self.assertRaises(ValueError) as cm: migration.check_impl_args(BUILD_SCRIPT_IMPL_PATH, ['--reconfigure', '--foo=true']) self.assertIn('foo', str(cm.exception))