[Piglit] [PATCH] grouptools.py: from_path should not return .
Dylan Baker
baker.dylan.c at gmail.com
Mon Jan 19 09:31:41 PST 2015
Since groups cannot be '.' (ie: 'foo/./bar' is not valid),
grouptools.from_path should not return '.', it should return ''
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/grouptools.py | 4 ++++
framework/tests/grouptools_tests.py | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/framework/grouptools.py b/framework/grouptools.py
index 7a7a127..3d26bbc 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -158,4 +158,8 @@ def from_path(path):
if '\\' in path:
return path.replace('\\', '/')
+
+ if '.' == path:
+ return ''
+
return path
diff --git a/framework/tests/grouptools_tests.py b/framework/tests/grouptools_tests.py
index f65ad10..94f44af 100644
--- a/framework/tests/grouptools_tests.py
+++ b/framework/tests/grouptools_tests.py
@@ -172,3 +172,8 @@ def test_from_path_posix():
def test_from_path_nt():
"""grouptools.from_path: converts \\ to / in nt paths."""
nt.assert_equal(grouptools.from_path('foo\\bar'), 'foo/bar')
+
+
+def test_from_path_dot():
+ """grouptools.from_path: should convert '.' into ''."""
+ nt.assert_equal(grouptools.from_path('.'), '')
--
2.2.1
More information about the Piglit
mailing list