moe-serifu-circle / moe-serifu-agent

Anime-themed personal assistant and goal-oriented intelligent agent
GNU Lesser General Public License v3.0
42 stars 7 forks source link

Prevent asyncio from ignoring exceptions in unit tests #109

Closed jghibiki closed 5 years ago

jghibiki commented 5 years ago

In some unit tests where the mock is improperly configured, the loop is being closed before all tasks have shutdown properly resulting in an exception which asyncio handles and ignores to prevent the event loop from breaking.

Design Details

Find a way to prevent asyncio from squashing this exception message wrongfully as we want it to cause a unit test failure if it happens.

Done When

Ignored exceptions are no longer ignored and are able to fail the unit tests.

jghibiki commented 5 years ago

Quote from python Unit Test docs

By default this runner shows DeprecationWarning, PendingDeprecationWarning, ResourceWarning and ImportWarning even if they are ignored by default. Deprecation warnings caused by deprecated unittest methods are also special-cased and, when the warning filters are 'default' or 'always', they will appear only once per-module, in order to avoid too many warning messages. This behavior can be overridden using Python’s -Wd or -Wa options (see Warning control) and leaving warnings to None.

jghibiki commented 5 years ago

Example Warning: /usr/lib64/python3.7/asyncio/base_events.py:607: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False> source=self)

This is one of the specified warnings, and it appears to be normal and accepted that ResourceWarnings not be elevated.

dekarrin commented 5 years ago

After discussion with @jghibiki we have decided to close this, as it is not causing unit tests to detect false positives or false negatives. Invalidation of unit tests is the primary concern, and that does not appear to be happening. I'd say let's just keep an eye out for that in the future, just in case, but for now I think we're good