from clinic import DSLParser
+def restore_dict(converters, old_converters):
+ converters.clear()
+ converters.update(old_converters)
+
+
+def save_restore_converters(testcase):
+ testcase.addCleanup(restore_dict, clinic.converters,
+ clinic.converters.copy())
+ testcase.addCleanup(restore_dict, clinic.legacy_converters,
+ clinic.legacy_converters.copy())
+ testcase.addCleanup(restore_dict, clinic.return_converters,
+ clinic.return_converters.copy())
+
+
class _ParserBase(TestCase):
maxDiff = None
class ClinicWholeFileTest(_ParserBase):
def setUp(self):
+ save_restore_converters(self)
self.clinic = clinic.Clinic(clinic.CLanguage(None), filename="test.c")
def expect_failure(self, raw):
maxDiff = None
clinic_py = os.path.join(test_tools.toolsdir, "clinic", "clinic.py")
+ def setUp(self):
+ save_restore_converters(self)
+
def _do_test(self, *args, expect_success=True):
with subprocess.Popen(
[sys.executable, "-Xutf8", self.clinic_py, *args],