ext/pci: handle 'qubes-close' event
Move cache cleanup to 'qubes-close' event handler, instead of doing it specifically in tests.
This commit is contained in:
parent
a89d3f0cae
commit
74e956e1f1
@ -313,6 +313,12 @@ class PCIDeviceExtension(qubes.ext.Extension):
|
||||
else:
|
||||
raise
|
||||
|
||||
@qubes.ext.handler('qubes-close', system=True)
|
||||
def on_app_close(self, app, event):
|
||||
# pylint: disable=unused-argument,no-self-use
|
||||
_cache_get.cache_clear()
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def _cache_get(vm, ident):
|
||||
''' Caching wrapper around `PCIDevice(vm, ident)`. '''
|
||||
|
@ -410,7 +410,6 @@ class QubesTestCase(unittest.TestCase):
|
||||
self.loop = asyncio.get_event_loop()
|
||||
self.addCleanup(self.cleanup_loop)
|
||||
self.addCleanup(self.cleanup_traceback)
|
||||
self.addCleanup(qubes.ext.pci._cache_get.cache_clear)
|
||||
|
||||
def cleanup_traceback(self):
|
||||
'''Remove local variables reference from tracebacks to allow garbage
|
||||
|
Loading…
Reference in New Issue
Block a user