[tests] Improvements for DeprecationTestCase
[tests] Improvements for DeprecationTestCase

- remove '.pyo' extension which was used by Python < 3.5 with -o option
- avoid deeply nested flow control in _build_message

Change-Id: Ifa2abed165d044f332d8c32ae05386baeb5cb4bd

wikimedia/pywikibot-core,wikimedia/pywikibot-core