[Piglit] [PATCH 2/7] grouptools.py: drop relgroup function

Dylan Baker baker.dylan.c at gmail.com
Thu Mar 12 15:42:05 PDT 2015


This function isn't actually used, and implementing a version that
doesn't rely on posixpath is a not very appealing. Since it's not used,
and one can easily use grouptools.from_path to implement the same
behavior (one could even revert this patch and wrap the implementation),
it's going away.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/grouptools.py             | 21 ---------------------
 framework/tests/grouptools_tests.py | 13 -------------
 2 files changed, 34 deletions(-)

diff --git a/framework/grouptools.py b/framework/grouptools.py
index 1000a51..cc0b4e9 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -35,7 +35,6 @@ import os.path
 __all__ = [
     'join',
     'commonprefix',
-    'relgroup',
     'split',
     'groupname',
     'testname',
@@ -136,26 +135,6 @@ def join(*args):
     return posixpath.join(*args)
 
 
-def relgroup(large, small):
-    """Find the relationship between two groups.
-
-    This allows the comparison of two groups, and returns a string. If start
-    start is longer than the group then '' is returned.
-
-    """
-    large = _normalize(large)
-    small = _normalize(small)
-    for element in {large, small}:
-        _assert_illegal(element)
-
-    if len(small) > len(large):
-        return ''
-    elif small == '' and large == '':
-        return ''
-    else:
-        return posixpath.relpath(large, small)
-
-
 def split(group):
     """Split the group into a list of elements.
 
diff --git a/framework/tests/grouptools_tests.py b/framework/tests/grouptools_tests.py
index 4efe746..de5aaba 100644
--- a/framework/tests/grouptools_tests.py
+++ b/framework/tests/grouptools_tests.py
@@ -144,9 +144,6 @@ def generate_tests():
          grouptools.join('g1', 'g2', 't1'), True),
         ('split', grouptools.split, grouptools.join('g1', 'g2', 't1'),
          ['g1', 'g2', 't1']),
-        ('relgroup', grouptools.relgroup,
-         [grouptools.join('g1', 'g2', 'g3', 't1'), grouptools.join('g1', 'g2')],
-         grouptools.join('g3', 't1'), True)
     ]
 
     for args in tests:
@@ -156,16 +153,6 @@ def generate_tests():
             yield wrapper, test
 
 
-def test_relgroup_small_gt_large():
-    """grouptools.relgroup: if small > large return ''."""
-    nt.assert_equal(grouptools.relgroup('foo', 'foobar'), '')
-
-
-def test_relgroup_both_empty():
-    """grouptools.relgroup: if small == '' and large == '' return ''."""
-    nt.assert_equal(grouptools.relgroup('', ''), '')
-
-
 def test_split_input_empty():
     """grouptools.split: an empty input returns []."""
     nt.assert_equal(grouptools.split(''), [])
-- 
2.3.1



More information about the Piglit mailing list