Mercurial > hg > configuration
annotate tests/unit.py @ 21:0fe74db6a56c
a hacky way to do CLI types handlers
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 26 Mar 2012 14:45:36 -0700 |
parents | cadc9514f60a |
children | 39f2611db9be |
rev | line source |
---|---|
0 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
4 unit tests | |
5 """ | |
6 | |
7 import os | |
8 import sys | |
9 import unittest | |
10 | |
19
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
11 from example import ExampleConfiguration # example configuration to test |
11
e00afe2c83bf
stubbing configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
12 |
0 | 13 # globals |
14 here = os.path.dirname(os.path.abspath(__file__)) | |
15 | |
16 class configurationUnitTest(unittest.TestCase): | |
17 | |
18 def test_configuration(self): | |
19
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
19 example = ExampleConfiguration() |
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
20 |
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
21 # parse command line arguments |
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
22 options, args = example.parse(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox']) |
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
23 self.assertEqual(bool(args), False) # no arguments |
cadc9514f60a
we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
24 self.assertEqual(options.develop, True) |
0 | 25 |
26 if __name__ == '__main__': | |
27 unittest.main() | |
28 |