Some unit tests in test_preprocessor.py are wrong

RESOLVED FIXED in Firefox 52

Status

defect
RESOLVED FIXED
3 years ago
a year ago

People

(Reporter: glandium, Assigned: glandium)

Tracking

unspecified
mozilla52
Dependency tree / graph

Firefox Tracking Flags

(firefox52 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

3 years ago
Fun thing: I had a "foo" file in my topsrcdir, and that led to the following error while running python/mozbuild/mozbuild/test/test_preprocessor.py:

TEST-UNEXPECTED-FAIL | python/mozbuild/mozbuild/test/test_preprocessor.py | TestPreprocessor.test_include_missing_file, line 622: '_AssertRaisesContext' object has no attribute 'key'
ERROR: test_include_missing_file (__main__.TestPreprocessor)
Traceback (most recent call last):
  File "python/mozbuild/mozbuild/test/test_preprocessor.py", line 622, in test_include_missing_file
    self.assertEqual(e.key, 'FILE_NOT_FOUND')
AttributeError: '_AssertRaisesContext' object has no attribute 'key'

As it turns out, what really happens is that the presence of the foo file makes the do_include on the line before that *not* raise an exception, and the error that should be reported, really, is that the exception was not raised.

What this also means is that under normal conditions, where do_include raises an exception this assertEqual is never reached.

This bug is about fixing this last thing. I'm not entirely convinced it's worth working around the possible presence of a "foo" file in the current directory the test runs from.
Assignee

Updated

3 years ago
Blocks: 952606

Comment 2

3 years ago
mozreview-review
Comment on attachment 8804953 [details]
Bug 1313259 - Fix some preprocessor unit tests to actually do the tests they're supposed to do.

https://reviewboard.mozilla.org/r/88764/#review88108
Attachment #8804953 - Flags: review?(gps) → review+

Comment 3

3 years ago
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/48c39daa6910
Fix some preprocessor unit tests to actually do the tests they're supposed to do. r=gps

Comment 4

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/48c39daa6910
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52

Updated

a year ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.