Bug 141030 - Web platform test server should not need to create __init__.py files
Summary: Web platform test server should not need to create __init__.py files
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-29 05:27 PST by youenn fablet
Modified: 2015-02-03 01:48 PST (History)
3 users (show)

See Also:


Attachments
Patch (7.86 KB, patch)
2015-02-02 03:26 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.