Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all script metadata to text #23644

Merged
merged 1 commit into from
May 18, 2020
Merged

Convert all script metadata to text #23644

merged 1 commit into from
May 18, 2020

Conversation

jgraham
Copy link
Contributor

@jgraham jgraham commented May 15, 2020

Otherwise we were getting a different type when loading the manifest
compared to when reading data from the initial file. This caused problems
in Python 3.

@wpt-pr-bot wpt-pr-bot added infra manifest serve wptrunner The automated test runner, commonly called through ./wpt run labels May 15, 2020
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23644 May 15, 2020 19:40 Inactive
tools/manifest/sourcefile.py Outdated Show resolved Hide resolved
tools/manifest/sourcefile.py Show resolved Hide resolved
tools/manifest/sourcefile.py Show resolved Hide resolved
tools/manifest/sourcefile.py Show resolved Hide resolved
Copy link
Member

@Hexcles Hexcles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And can we add a test that would fail without this fix?

@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23644 May 15, 2020 21:40 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23644 May 17, 2020 18:49 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23644 May 17, 2020 21:49 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23644 May 18, 2020 07:23 Inactive
tools/manifest/sourcefile.py Outdated Show resolved Hide resolved
tools/manifest/sourcefile.py Outdated Show resolved Hide resolved
tools/manifest/sourcefile.py Outdated Show resolved Hide resolved
tools/manifest/sourcefile.py Outdated Show resolved Hide resolved
tools/manifest/sourcefile.py Show resolved Hide resolved
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23644 May 18, 2020 12:49 Inactive
assert isinstance(value, text_type), value
except Exception:
import pdb
pdb.post_mortem()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you add this to debug something? Most other pdb.post_mortem() go together with a traceback.print_exc(), and many are also conditional. So it's hard to tell if this is leftover debugging or useful to leave here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Pure debugging leftover.

tools/manifest/sourcefile.py Show resolved Hide resolved
Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % nits, my comments don't require another round of review

Otherwise we were getting a different type when loading the manifest
compared to when reading data from the initial file. This caused problems
in Python 3.
@jgraham jgraham merged commit f4a3431 into master May 18, 2020
@jgraham jgraham deleted the script_metadata_text branch May 18, 2020 13:57
stephenmcgruer added a commit that referenced this pull request May 19, 2020
Reusing variables can cause a mypy type error (python/mypy#1174).
This previously went unnoticed because the previous and current use of `key` was `str`, but in
#23644 the previous use was retyped to `Text`
and as such caused a unicode-vs-str type error in mypy.
Copy link
Member

@Hexcles Hexcles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay; it was a holiday. And thanks for reviewing, Philip!

LGTM % a nit/question

@@ -864,11 +864,11 @@ def manifest_items(self):
)]

elif self.name_is_multi_global:
globals = b""
globals = u""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it's a bit inconsistent that some text strings are prefixed with u while the others are not. Shall we apply the future lint for string literals to tools/ as well? @jgraham

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request May 27, 2020
…, a=testonly

Automatic update from web-platform-tests
Rename variable to avoid mypy type error (#23669)

Reusing variables can cause a mypy type error (python/mypy#1174).
This previously went unnoticed because the previous and current use of `key` was `str`, but in
web-platform-tests/wpt#23644 the previous use was retyped to `Text`
and as such caused a unicode-vs-str type error in mypy.
--

wpt-commits: 7b9a66f8a9cf68bbe220473f9eff0e652998c072
wpt-pr: 23669
xeonchen pushed a commit to xeonchen/gecko that referenced this pull request May 27, 2020
…, a=testonly

Automatic update from web-platform-tests
Rename variable to avoid mypy type error (#23669)

Reusing variables can cause a mypy type error (python/mypy#1174).
This previously went unnoticed because the previous and current use of `key` was `str`, but in
web-platform-tests/wpt#23644 the previous use was retyped to `Text`
and as such caused a unicode-vs-str type error in mypy.
--

wpt-commits: 7b9a66f8a9cf68bbe220473f9eff0e652998c072
wpt-pr: 23669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra lint manifest python3 serve wptrunner The automated test runner, commonly called through ./wpt run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants