Skip to content
  • Dylan Baker's avatar
    profile.py: Add a context_manager to TestProfile for adding tests. · 569c7d15
    Dylan Baker authored
    
    
    This adds a very powerful method to the TestProfile class,
    group_manager. This group_manager method is a context_manager (it's used
    with the 'with' statement), and is passed a test class and a flattened
    group name (such as one returned by grouptools.join), and yields a
    callable that is used to add tests to the profile.
    
    This gives us a lot of advantages. First, it means that tests are added
    in a context, so if we need to define data structures for adding tests
    to a specific group (say a list of texture formats supported by a
    specific version of GL), that data structure is defined in a nested
    scope, so it cannot be accidentally be used in a different group.
    Second, it means not passing a group around anymore, in fact, it creates
    an abstraction on top of the group data structure so it doesn't matter
    how we're representing it. Third the function itself is more flexible
    than anything we've had before. It can either take an explicit name, or
    it can call ' '.join() on the arguments to the Test, and use that as a
    name, which can help make Test assignments much less verbose.
    
    Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
    569c7d15