Closed Bug 1313259 Opened 4 years ago Closed 4 years ago

Some unit tests in test_preprocessor.py are wrong

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox52 fixed)

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

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.
Blocks: 952606
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+
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
https://hg.mozilla.org/mozilla-central/rev/48c39daa6910
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.