| Index: recipe_engine/recipe_test_api.py
|
| diff --git a/recipe_engine/recipe_test_api.py b/recipe_engine/recipe_test_api.py
|
| index e9e0431d86c7a4a68f8649ee32ff4315d0dbe768..d4186fb2af50f626863c37061d9953fb52dbf365 100644
|
| --- a/recipe_engine/recipe_test_api.py
|
| +++ b/recipe_engine/recipe_test_api.py
|
| @@ -4,6 +4,7 @@
|
|
|
| import contextlib
|
| import inspect
|
| +import re
|
|
|
| from collections import namedtuple, defaultdict
|
|
|
| @@ -187,9 +188,18 @@ PostprocessHook = namedtuple(
|
| 'PostprocessHook', 'func args kwargs filename lineno')
|
|
|
|
|
| +def is_valid_test_name(name):
|
| + return bool(re.match(r'^(\w)+$', name))
|
| +
|
| +
|
| class TestData(BaseTestData):
|
| def __init__(self, name=None):
|
| super(TestData, self).__init__()
|
| + # Allow empty names; sometimes we create test datas to merge two test datas
|
| + # together.
|
| + if name and not is_valid_test_name(name):
|
| + raise ValueError("Invalid test name %r" % name)
|
| +
|
| self.name = name
|
| self.properties = {} # key -> val
|
| self.mod_data = defaultdict(ModuleTestData)
|
|
|