blob: d80f5e64774cc3407dc05a2755efe3866cb5f33e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# -*- coding: utf-8 -*-
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
import contextlib
import tempfile
import shutil
import unittest
class Spy(object):
def __init__(self):
self.arg = None
self.success = 0
def call(self, params):
self.arg = params
return self.success
@contextlib.contextmanager
def TempDir():
name = tempfile.mkdtemp(prefix='scan-build-test-')
try:
yield name
finally:
shutil.rmtree(name)
class TestCase(unittest.TestCase):
def assertIn(self, element, collection):
found = False
for it in collection:
if element == it:
found = True
self.assertTrue(found, '{0} does not have {1}'.format(collection,
element))
|