Closed Bug 1391123 Opened 4 years ago Closed 4 years ago

./mach try fuzzy should add a newline at the end of try_task_config.json

Categories

(Testing :: General, enhancement)

Version 3
enhancement
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: KWierso, Assigned: KWierso)

Details

Attachments

(1 file)

Looking at https://hg.mozilla.org/try/rev/d2539729043c396ee050207160bd5cdfd1121375 it complains about no newline at the end of the file. It should be pretty easy to add a newline and have it stop complaining about that.
This seems to work. Is there a test that would need updated anywhere?
Assignee: nobody → wkocher
Comment on attachment 8908918 [details]
Bug 1391123 - Add a newline to the end of try_task_config.json

https://reviewboard.mozilla.org/r/180536/#review185672

AFAIK there are no tests that need to be updated for this.

::: tools/tryselect/vcs.py:88
(Diff revision 1)
>          with open(config, 'w') as fh:
>              try_task_config = {'tasks': sorted(labels)}
>              if templates:
>                  try_task_config['templates'] = templates
>  
> -            json.dump(try_task_config, fh, indent=2, separators=(',', ':'))
> +            json_text = json.dumps(try_task_config, indent=2, separators=(',', ':'))

We should continue to use ``json.dump`` here. Just add an ``fh.write('\n')`` after it to add the newline.
Attachment #8908918 - Flags: review?(gps) → review-
Comment on attachment 8908918 [details]
Bug 1391123 - Add a newline to the end of try_task_config.json

https://reviewboard.mozilla.org/r/180536/#review185676
Attachment #8908918 - Flags: review?(wkocher)
Comment on attachment 8908918 [details]
Bug 1391123 - Add a newline to the end of try_task_config.json

https://reviewboard.mozilla.org/r/180536/#review185678

Oh, I do see there are "cram" tests for `mach try`. I even reviewed them, heh. `mach cramtest tools/tryselect`. Although they fail for me locally :/

You might want to run this by Try via `mach try fuzzy cram`.
Attachment #8908918 - Flags: review?(gps) → review+
Updated the tests so they pass. I'm not sure why I had to add the whitespace to the newlines, though... Does that seem right to you?
Flags: needinfo?(gps)
The whitespace is needed to preserve the added newline. I reckon somewhere we are doing a print(), which will print the newline from the JSON plus a newline itself. (print() emits a trailing newline unless you tell it not to.)

I wouldn't worry too much about it. Let's land this.
Flags: needinfo?(gps)
Pushed by kwierso@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6835fc2e493b
Add a newline to the end of try_task_config.json r=gps
https://hg.mozilla.org/mozilla-central/rev/6835fc2e493b
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.