Bug 141030

Summary: Web platform test server should not need to create __init__.py files
Product: WebKit Reporter: youenn fablet <youennf>
Component: Tools / TestsAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, glenn, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description youenn fablet 2015-01-29 05:27:51 PST
Web Platform Test Server makes use of empty __init__.py files to enable module import.
Some bots seem to have difficulties with those empty __init__.py files as they do not show up in the file system.

The current solution implemented in Tools/Scripts/webkitpy/layout_tests/servers/web_platform_tests_layncher.py is to create those files if they do not exist.

A cleaner solution may be to detect those files when importing them and fill them with  a comment such as '# Required for Python to search this directory for module files'.

In addition a webkitpy unit test should be added to ensure that wpt module import is working in webkitpy.layout_tests.servers.web_platform_test_server_unittest.py, something like:
    def test_import_web_platform_test_modules(self):
        fs = FileSystem()
        current_dir, name = fs.split(fs.realpath(__file__))
        doc_root_dir = fs.join(current_dir, "..", "..", "..", "..", "..", "LayoutTests", "imported", "w3c", "web-platform-tests")
        tools_dir = fs.join(doc_root_dir, "tools")

        sys.path.insert(0, doc_root_dir)
        try:
            file, pathname, description = imp.find_module("tools")
        except ImportError, e:
            self.fail(e)
        self.assertEqual(pathname, tools_dir)
        sys.path.pop(0)

        sys.path.insert(0, tools_dir)
        try:
            file, pathname, description = imp.find_module("scripts")
        except ImportError, e:
            self.fail(e)
        self.assertEqual(pathname, fs.join(tools_dir, "scripts"))
        sys.path.pop(0)
Comment 1 youenn fablet 2015-02-02 03:26:54 PST
Created attachment 245864 [details]
Patch
Comment 2 WebKit Commit Bot 2015-02-03 01:48:07 PST
Comment on attachment 245864 [details]
Patch

Clearing flags on attachment: 245864

Committed r179545: <http://trac.webkit.org/changeset/179545>
Comment 3 WebKit Commit Bot 2015-02-03 01:48:09 PST
All reviewed patches have been landed.  Closing bug.