[Piglit] [PATCH 06/44] unittests: use six.moves.getcwd

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Jan 27 16:06:14 PST 2016


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

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 unittests/core_tests.py         | 7 ++++---
 unittests/summary_html_tests.py | 3 ++-
 unittests/utils.py              | 3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/unittests/core_tests.py b/unittests/core_tests.py
index bc80a47..7f6e520 100644
--- a/unittests/core_tests.py
+++ b/unittests/core_tests.py
@@ -21,13 +21,14 @@
 """ Module providing tests for the core module """
 
 from __future__ import absolute_import, division, print_function
-import os
 import collections
+import functools
+import os
 import shutil
 import textwrap
-import functools
 
 import nose.tools as nt
+from six.moves import getcwd
 
 from framework import core, exceptions
 from . import utils
@@ -200,7 +201,7 @@ def test_piglit_root():
     """core.get_config() finds "piglit root"/piglit.conf"""
     with open('piglit.conf', 'w') as f:
         f.write(_CONF_FILE)
-    return_dir = os.getcwd()
+    return_dir = getcwd()
     try:
         os.chdir('..')
         core.get_config()
diff --git a/unittests/summary_html_tests.py b/unittests/summary_html_tests.py
index c202b60..523ab39 100644
--- a/unittests/summary_html_tests.py
+++ b/unittests/summary_html_tests.py
@@ -26,6 +26,7 @@ from __future__ import absolute_import, division, print_function
 import os
 
 import nose.tools as nt
+from six.moves import getcwd
 
 from framework.summary import html_
 from . import utils
@@ -34,6 +35,6 @@ from . import utils
 @utils.test_in_tempdir
 def test_copy_static():
     """summary.html_._copy_static: puts status content in correct locations"""
-    html_._copy_static_files(os.getcwd())
+    html_._copy_static_files(getcwd())
     nt.ok_(os.path.exists('index.css'), msg='index.css not created correctly')
     nt.ok_(os.path.exists('result.css'), msg='result.css not created correctly')
diff --git a/unittests/utils.py b/unittests/utils.py
index 190056d..ec2334e 100644
--- a/unittests/utils.py
+++ b/unittests/utils.py
@@ -42,6 +42,7 @@ try:
 except ImportError:
     import json
 from nose.plugins.skip import SkipTest
+from six.moves import getcwdb
 
 from framework import test, backends, core, results
 
@@ -336,7 +337,7 @@ def test_in_tempdir(func):
     returns to the original directory after the test completes.
 
     """
-    original_dir = os.getcwd()
+    original_dir = getcwdb()
 
     @functools.wraps(func)
     def wrapper(*args, **kwargs):
-- 
2.7.0



More information about the Piglit mailing list