def verify_conan_name(name): try: ConanName.validate_name(name) except InvalidNameException as e: print(e.args[0]) exit(1) return name
def validate_name_test(self): self.assertIsNone(ConanName.validate_name("string.dot.under-score.123")) self.assertIsNone(ConanName.validate_name("_underscore+123")) self.assertIsNone(ConanName.validate_name("*")) self.assertIsNone(ConanName.validate_name("a" * ConanName._min_chars)) self.assertIsNone(ConanName.validate_name("a" * ConanName._max_chars)) self.assertIsNone(ConanName.validate_name("a" * 50)) # Regression test
def validate_name_version_test(self): self.assertIsNone(ConanName.validate_name("[vvvv]", version=True))
def _check_invalid_type(self, value): with six.assertRaisesRegex(self, InvalidNameException, "is not a string"): ConanName.validate_name(value)
def _check_invalid_format(self, value, *args): with six.assertRaisesRegex(self, InvalidNameException, "Valid names"): ConanName.validate_name(value, *args)