Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(776)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py

Issue 2143123004: Access environment variables through Host object instead of directly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and updated after change for dummy home dir on linux. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
index c14803152a39946d9a83aa289ea79159dfe6c843..fb09b1bfe1f800864eb9226f9249b01558a961ec 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux_unittest.py
@@ -26,8 +26,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import os
-
from webkitpy.common.system import executive_mock
from webkitpy.common.system.systemhost_mock import MockSystemHost
from webkitpy.layout_tests.port import linux
@@ -42,13 +40,6 @@ class LinuxPortTest(port_testcase.PortTestCase):
full_port_name = 'linux-trusty'
port_maker = linux.LinuxPort
- def setUp(self):
- # TODO(qyearsley): Remove this when crbug.com/627887 is fixed.
- self.original_environ = os.environ.copy()
-
- def tearDown(self):
- os.environ = self.original_environ
-
def assert_version_properties(self, port_name, os_version, expected_name,
expected_version,
driver_file_output=None):
@@ -110,19 +101,18 @@ class LinuxPortTest(port_testcase.PortTestCase):
self.assertEqual(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/image_diff')
def test_dummy_home_dir_is_created_and_cleaned_up(self):
- original_home = '/home/user'
- os.environ['HOME'] = original_home
port = self.make_port()
+ port.host.environ['HOME'] = '/home/user'
port._filesystem.files['/home/user/.Xauthority'] = ''
# Set up the test run; the temporary home directory should be set up.
port.setup_test_run()
- temp_home_dir = os.environ['HOME']
- self.assertNotEqual(temp_home_dir, original_home)
+ temp_home_dir = port.host.environ['HOME']
+ self.assertNotEqual(temp_home_dir, '/home/user')
self.assertTrue(port._filesystem.isdir(temp_home_dir))
self.assertTrue(port._filesystem.isfile(port._filesystem.join(temp_home_dir, '.Xauthority')))
# Clean up; HOME should be reset and the temp dir should be cleaned up.
port.clean_up_test_run()
- self.assertEqual(os.environ.get('HOME'), original_home)
+ self.assertEqual(port.host.environ['HOME'], '/home/user')
self.assertFalse(port._filesystem.exists(temp_home_dir))

Powered by Google App Engine
This is Rietveld 408576698