示例#1
0
文件: util.py 项目: timdiels/gup
	def tearDown(self):
		self._teardown();
		super(TestCase, self).tearDown()

		## permutations
		if len(GUP_EXES) > 1 and self.invocation_count > 1:
			test_method = getattr(self, self._testMethodName)
			if getattr(test_method, 'skip_permutations', None) is _skip_permutation_sentinel:
				return

			log.debug("running permutations based on %s invocations ..." % self.invocation_count)
			print("", file=sys.stderr)
			gup_exe_sequences = list(itertools.product(GUP_EXES, repeat=self.invocation_count))
			for sequence in gup_exe_sequences:
				if all([exe == GUP_EXES[0] for exe in sequence]):
					# this is what the first test run does; skip it
					continue
				permutation_desc = [path.split(os.path.sep)[-3] for path in sequence]
				print("-- PERMUTATION: %r" % (permutation_desc,), file=sys.stderr)
				log.info("\n\n-----------------------\nPERMUTATION: %r", permutation_desc)
				self.exes = iter(sequence)
				self.setUp()
				try:
					test_method()
				finally:
					self._teardown()
					#XXX hack
					mocktest._teardown()
示例#2
0
	def tearDown(self):
		self._teardown();
		super(TestCase, self).tearDown()

		## permutations
		if len(GUP_EXES) > 1 and self.invocation_count > 1:
			test_method = getattr(self, self._testMethodName)
			if getattr(test_method, 'skip_permutations', None) is _skip_permutation_sentinel:
				return

			log.debug("running permutations based on %s invocations ..." % self.invocation_count)
			print("", file=sys.stderr)
			gup_exe_sequences = list(itertools.product(GUP_EXES, repeat=self.invocation_count))
			for sequence in gup_exe_sequences:
				if all([exe == GUP_EXES[0] for exe in sequence]):
					# this is what the first test run does; skip it
					continue
				permutation_desc = [path.split(os.path.sep)[-3] for path in sequence]
				print("-- PERMUTATION: %r" % (permutation_desc,), file=sys.stderr)
				log.info("\n\n-----------------------\nPERMUTATION: %r", permutation_desc)
				self.exes = iter(sequence)
				self.setUp()
				try:
					test_method()
				finally:
					self._teardown()
					#XXX hack
					mocktest._teardown()
示例#3
0
 def run_suite(self, class_):
     mocktest._teardown()
     suite = unittest.makeSuite(class_)
     result = unittest.TestResult()
     suite.run(result)
     ret = result
     mocktest._setup()
     return result
示例#4
0
    def test_invalid_usage_after_teardown(self):
        mocktest._teardown()

        e = None
        try:
            mock_wrapper()
        except Exception, e_:
            e = e_
示例#5
0
 def tearDown(self):
     print "all expectations is %r" % (mocktest.mock.MockWrapper._all_expectations,)
     mocktest._teardown()
示例#6
0
	def downup(self):
		mocktest._teardown()
		mocktest._setup()