Skip to content
  • Dylan Baker's avatar
    profile.py: Don't allow accidental reassignments of TestDict keys · dfd8d8f9
    Dylan Baker authored
    
    
    A common error in all.py is that two different tests are assigned to the
    same key value in profile.test_list. This change prevents a key from
    being reassigned to a new value on accident, but provides a mechanism to
    allow reassignment, using a context manager. This allows tests like the
    image_load_store tests in quick.py to be overwritten, but requires the
    author to mark that they know that they are overwriting tests, and that
    it's intentional.
    
    The error message will compare the tests by command, if the two tests
    have different commands then the commands will be printed for easy
    visual comparison. This helps to identify whether a test is being added
    twice (in a loop for example) or if two different tests are being
    assigned the same name.
    
    This also adds some tests for TestDict.
    
    v2: - remove some rebase artifacts, this makes the code a little simpler
          and a little cleaner
    v3: - rebase on master, includes grouptools separator changes
    v4: - Use a incremented value instead of True false for the context
          manager, this allows the allow_reassignment contextmanager to be
          nested.  (Ilia)
    v5: - Add comparison methods to the Test class
        - Use said comparisons to make the error reporting more verbose
    
    Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
    Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v4)
    dfd8d8f9