run_unittests: remove unused PatchModule class

pull/6207/head
Dylan Baker 5 years ago
parent 2450cd6a9f
commit 71e3fac5af
  1. 21
      run_unittests.py

@ -290,26 +290,6 @@ def no_pkgconfig():
shutil.which = old_which
ExternalProgram._search = old_search
class PatchModule:
'''
Fancy monkey-patching! Whee! Can't use mock.patch because it only
patches in the local namespace.
'''
def __init__(self, func, name, impl):
self.func = func
assert(isinstance(name, str))
self.func_name = name
self.old_impl = None
self.new_impl = impl
def __enter__(self):
self.old_impl = self.func
exec('{} = self.new_impl'.format(self.func_name))
def __exit__(self, *args):
exec('{} = self.old_impl'.format(self.func_name))
class InternalTests(unittest.TestCase):
@ -5743,6 +5723,7 @@ c = ['{0}']
self.build()
self.run_tests()
def should_run_cross_arm_tests():
return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm')

Loading…
Cancel
Save