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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.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/port_testcase.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index 9ec7f6d59a5e400cc39ec62680a86a7983607117..e3a972f0c472201b45931548a273066d397b5792 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -30,7 +30,6 @@
import collections
import errno
-import os
import socket
import unittest
@@ -403,27 +402,20 @@ class PortTestCase(unittest.TestCase):
def test_path_to_apache_config_file(self):
port = TestWebKitPort()
- saved_environ = os.environ.copy()
- try:
- os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf'
- self.assertRaises(IOError, port.path_to_apache_config_file)
- port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, world!')
- os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf'
- self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd.conf')
- finally:
- os.environ = saved_environ.copy()
+ port.host.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf'
+ self.assertRaises(IOError, port.path_to_apache_config_file)
+ port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, world!')
+ port.host.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf'
+ self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd.conf')
# Mock out _apache_config_file_name_for_platform to avoid mocking platform info
port._apache_config_file_name_for_platform = lambda: 'httpd.conf'
+ del port.host.environ['WEBKIT_HTTP_SERVER_CONF_PATH']
self.assertEqual(port.path_to_apache_config_file(), '/mock-checkout/third_party/WebKit/LayoutTests/http/conf/httpd.conf')
# Check that even if we mock out _apache_config_file_name, the environment variable takes precedence.
- saved_environ = os.environ.copy()
- try:
- os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf'
- self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd.conf')
- finally:
- os.environ = saved_environ.copy()
+ port.host.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf'
+ self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd.conf')
def test_additional_platform_directory(self):
port = self.make_port(options=MockOptions(additional_platform_directory=['/tmp/foo']))

Powered by Google App Engine
This is Rietveld 408576698