2
# -*- coding: UTF-8 -*-
6
# (c) 2008 Alberto Milone <albertomilone@alice.it>
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License along
19
# with this program; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
import unittest, os.path, sys, logging, os
26
instructionsList = ['The only accepted (optional) parameters are:'
27
'\n -o, --output=<dirname>', '\tthe directory where the results \n\
28
\t\t\t\tof the tests are saved.'
30
'\n -i, --input=<filename>', '\tthe xorg.conf used for the tests.'
32
'\n -h, --help', '\t\t\thelp page.'
34
print ''.join(instructionsList)
38
inputFile = os.path.join(cwd, 'xorg.conf')
40
err = 'Error: parameters not recognised'
43
opts, args = getopt.getopt(sys.argv[1:], 'h:o:i:', ['help', 'output=', 'input='])
44
except getopt.GetoptError, err:
45
# print help information and exit:
46
print str(err) # will print something like 'option -a not recognized'
52
if o in ('-i', '--input'):
54
elif o in ('-o', '--output'):
56
elif o in ('-h', '--help'):
60
assert False, 'unhandled option'
63
settingsFile = open('settings.py', 'w')
64
if inputFile == os.path.join(cwd, 'xorg.conf') and outputDir == cwd:
65
settingsFile.write('import os\ncwd = os.getcwd()\ninputFile = os.path.join(cwd, "xorg.conf")\noutputDir = cwd')
67
settingsFile.write('inputFile = "%s"\noutputDir = "%s"' % (inputFile, outputDir))
70
# run all tests in our directory
71
suite = unittest.TestLoader().loadTestsFromNames(
72
[t[:-3] for t in os.listdir(os.path.dirname(__file__))
73
if t.endswith('.py') and t not in ['settings.py', '__init__.py']])
74
res = unittest.TextTestRunner(verbosity=2).run(suite)
77
if __name__ == '__main__':