Skip to content

Commit

Permalink
Fix TestharnessTest to have a correct meta_key
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnedders committed Feb 26, 2019
1 parent a4acc6b commit d7416f7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tools/manifest/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ def script_metadata(self):
return self._source_file.script_metadata

def meta_key(self):
return (self.timeout, self.testdriver)
script_metadata = self.script_metadata
if script_metadata is not None:
script_metadata = tuple(tuple(x) for x in script_metadata)
return (self.timeout, self.testdriver, self.jsshell, script_metadata)

def to_json(self):
rv = URLManifestItem.to_json(self)
Expand Down
27 changes: 26 additions & 1 deletion tools/manifest/tests/test_item.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from ..item import URLManifestItem
from ..item import URLManifestItem, TestharnessTest


@pytest.mark.parametrize("path", [
Expand Down Expand Up @@ -39,3 +39,28 @@ def test_url_not_https(path):
m = URLManifestItem("/foobar", "/" + path, "/", "/foo.bar/" + path)

assert m.https is False


def test_testharness_meta_key_includes_jsshell():
a = TestharnessTest("/foobar", "/foo", "/foo.bar", "/foo.bar/foo",
jsshell=False, script_metadata=[])
b = TestharnessTest("/foobar", "/foo", "/foo.bar", "/foo.bar/foo",
jsshell=True, script_metadata=[])

assert a.meta_key() != b.meta_key()


@pytest.mark.parametrize("script_metadata", [
None,
[],
[('script', '/resources/WebIDLParser.js'), ('script', '/resources/idlharness.js')],
[[u'script', u'/resources/WebIDLParser.js'], [u'script', u'/resources/idlharness.js']],
])
def test_testharness_hashable_script_metadata(script_metadata):
a = TestharnessTest("/",
"BackgroundSync/interfaces.https.any.js",
"/",
"/BackgroundSync/interfaces.https.any.js",
script_metadata=script_metadata)

assert hash(a) is not None

0 comments on commit d7416f7

Please sign in to comment.