My Python & co. stuff

Archive for the ‘Twisted’ Category

Ugly and lame… but it is working! Just edit pysrc/ (on my machine it is somewhere, like, here: C:\eclipse-galileo\plugins\org.python.pydev.debug_1.4.6.2788\pysrc\ to use Twisted Trial with Eclipse’s PyDev “Run as Unit-test” option.

If you run a directory as a unit-test, the code below assumes, that tests are located in [directory]/test . If you run a file as a unit test, the code assumes, that the test file is located in ./test/test_[filename].py .

#======================================================================================================================= # main #======================================================================================================================= if __name__ == '__main__': dirs, verbosity, test_filter = parse_cmdline() for element in dirs: import os, sys fn = os.path.splitext(os.path.basename(element))[0] if os.path.isfile(element): tn = 'test.test_%s' % fn else: tn = '%s.test' % fn os.environ['PYTHONPATH'] = '.' os.system(' ' + tn)