Closed Bug 1313259 Opened 5 years ago Closed 5 years ago
Some unit tests in test
_preprocessor .py are wrong
58 bytes, text/x-review-board-request
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.
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 email@example.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
You need to log in before you can comment on or make changes to this bug.