Closed Bug 1147723 Opened 5 years ago Closed 5 years ago

Avoid non TEST_PASS/TEST_UNEXPECTED_FAIL output from test_files.py

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox38 fixed, firefox39 fixed, firefox40 fixed)

RESOLVED FIXED
mozilla40
Tracking Status
firefox38 --- fixed
firefox39 --- fixed
firefox40 --- fixed

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(1 file)

No description provided.
Instead, capture the output and check it's being printed.
Attachment #8583565 - Flags: review?(gps)
Comment on attachment 8583565 [details] [diff] [review]
Avoid non TEST_PASS/TEST_UNEXPECTED_FAIL output from test_files.py

Review of attachment 8583565 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozpack/test/test_files.py
@@ +798,5 @@
>          self.assertTrue(len(mini_lines) < len(self.orig_lines))
>  
>      def test_minified_verify_failure(self):
>          orig_f = GeneratedFile('\n'.join(self.orig_lines))
> +        errors.out = StringIO()

FWIW, I tried with io.StringIO, and it doesn't work because it's being fed strs, and it wants unicode instances. I didn't feel like dealing with changing the errors module to handle that.
Presumably you could use codecs.getdecoder to wrap it, but meh.
Comment on attachment 8583565 [details] [diff] [review]
Avoid non TEST_PASS/TEST_UNEXPECTED_FAIL output from test_files.py

Review of attachment 8583565 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozpack/test/support/minify_js_verify.py
@@ +10,5 @@
>  
> +retcode = int(sys.argv[1])
> +
> +if retcode:
> +    print >>sys.stderr, 'Error message'

Please use print() so we are future compatible.

print('Error message', file=sys.stderr)
Attachment #8583565 - Flags: review?(gps) → review+
https://hg.mozilla.org/mozilla-central/rev/ad21ae45c5cc
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.