Python tests.TestCase() Examples

The following are 5 code examples of tests.TestCase(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tests , or try the search function .
Example #1
Source File: package.py    From zim-desktop-wiki with GNU General Public License v2.0 6 votes vote down vote up
def runTest(self):
		# Check build_dist script
		from setup import fix_dist
		fix_dist()

		# Check desktop file
		try:
			subprocess.check_call(['desktop-file-validate', 'xdg/zim.desktop'])
		except OSError:
			print("Could not run desktop-file-validate")


#~ @tests.slowTest
#~ class TestNotebookUpgrade(tests.TestCase):
#~
	#~ def runTest(self):
		#~ '''Test if included notebooks are up to date'''
		#~ from zim.fs import Dir
		#~ from zim.notebook import init_notebook
		#~ for path in ('data/manual', 'HACKING'):
			#~ notebook = init_notebook(Dir(path))
			#~ self.assertTrue(not notebook.needs_upgrade) 
Example #2
Source File: indexviews.py    From zim-desktop-wiki with GNU General Public License v2.0 6 votes vote down vote up
def _get_sql(files):
	folder = MockFolder('/mock/notebook/')
	indexer = buildUpdateIter(folder)
	for path, text in files:
		folder.file(path).write(text)
	indexer.check_and_update()
	lines = list(indexer.db.iterdump())
	indexer.db.close()
	return '\n'.join(lines)


#class TestMemoryIndex(tests.TestCase):
#
#	def runTest(self):
#		db = new_test_database()
#		for line in db.iterdump():
#			print line 
Example #3
Source File: pageview.py    From zim-desktop-wiki with GNU General Public License v2.0 5 votes vote down vote up
def setUpClass(cls):
		tests.TestCase.setUpClass()

		preferences = dict((p[0], p[4]) for p in ui_preferences)
		cls.view = TextView(preferences)
		cls.buffer = TextBuffer(None, None)
		cls.view.set_buffer(cls.buffer)

		press(cls.view, 'aaa\n')
		start, end = cls.buffer.get_bounds()
		assert cls.buffer.get_text(start, end, True) == 'aaa\n', 'Just checking test routines work' 
Example #4
Source File: pageview.py    From zim-desktop-wiki with GNU General Public License v2.0 5 votes vote down vote up
def setUpClass(cls):
		tests.TestCase.setUpClass()

		preferences = dict((p[0], p[4]) for p in ui_preferences)
		cls.view = TextView(preferences)
		cls.buffer = TextBuffer(None, None)
		cls.view.set_buffer(cls.buffer)

		cls.view.preferences['auto_reformat'] = True

		press(cls.view, 'aaa\n')
		start, end = cls.buffer.get_bounds()
		assert cls.buffer.get_text(start, end, True) == 'aaa\n', 'Just checking test routines work' 
Example #5
Source File: package.py    From zim-desktop-wiki with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, *a):
		self._code_files = []
		tests.TestCase.__init__(self, *a)