[Piglit] [PATCH 07/14] framework: rename core.checkDir to core.check_dir

Dylan Baker dylan at pnwbakers.com
Fri May 6 20:07:17 UTC 2016


From: Dylan Baker <baker.dylan.c at gmail.com>

This is the PEP8 proper format for the name, and since piglit tries to
conform to PEP8 as practical it makes sense to rename this. It is pretty
much the non-PEP8 named function in piglit.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/core.py             |  2 +-
 framework/programs/summary.py |  2 +-
 unittests/core_tests.py       | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index d052bd5..dfab227 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -115,7 +115,7 @@ def get_config(arg=None):
 
 
 # Ensure the given directory exists
-def checkDir(dirname, failifexists):
+def check_dir(dirname, failifexists):
     try:
         os.stat(dirname)
     except OSError as e:
diff --git a/framework/programs/summary.py b/framework/programs/summary.py
index 13368e4..c297a7b 100644
--- a/framework/programs/summary.py
+++ b/framework/programs/summary.py
@@ -102,7 +102,7 @@ def html(input_):
 
     # If the requested directory doesn't exist, create it or throw an error
     try:
-        core.checkDir(args.summaryDir, not args.overwrite)
+        core.check_dir(args.summaryDir, not args.overwrite)
     except exceptions.PiglitException:
         raise exceptions.PiglitFatalError(
             '{} already exists.\n'
diff --git a/unittests/core_tests.py b/unittests/core_tests.py
index e152336..c0ea523 100644
--- a/unittests/core_tests.py
+++ b/unittests/core_tests.py
@@ -282,7 +282,7 @@ class TestPiglitConfig(object):
 def test_check_dir_exists_fail():
     """core.check_dir: if the directory exists and failifexsits is True fail"""
     with mock.patch('framework.core.os.stat', mock.Mock(side_effect=OSError)):
-        core.checkDir('foo', True)
+        core.check_dir('foo', True)
 
 
 def test_check_dir_stat_ENOENT():
@@ -290,7 +290,7 @@ def test_check_dir_stat_ENOENT():
     with mock.patch('framework.core.os.stat',
                     mock.Mock(side_effect=OSError('foo', errno.ENOENT))):
         with mock.patch('framework.core.os.makedirs') as makedirs:
-            core.checkDir('foo', False)
+            core.check_dir('foo', False)
             nt.eq_(makedirs.called, 1)
 
 
@@ -299,7 +299,7 @@ def test_check_dir_stat_ENOTDIR():
     with mock.patch('framework.core.os.stat',
                     mock.Mock(side_effect=OSError('foo', errno.ENOTDIR))):
         with mock.patch('framework.core.os.makedirs') as makedirs:
-            core.checkDir('foo', False)
+            core.check_dir('foo', False)
             nt.eq_(makedirs.called, 1)
 
 
@@ -309,7 +309,7 @@ def test_check_dir_makedirs_pass():
     with mock.patch('framework.core.os.stat', mock.Mock()):
         with mock.patch('framework.core.os.makedirs',
                         mock.Mock(side_effect=OSError(errno.EEXIST, 'foo'))):
-            core.checkDir('foo', False)
+            core.check_dir('foo', False)
 
 
 @nt.raises(OSError)
@@ -320,4 +320,4 @@ def test_check_dir_makedirs_fail():
                         mock.Mock(return_value=False)):
             with mock.patch('framework.core.os.makedirs',
                             mock.Mock(side_effect=OSError)):
-                core.checkDir('foo', False)
+                core.check_dir('foo', False)
-- 
2.8.2



More information about the Piglit mailing list