587
|
1 |
#============================================================================
|
|
2 |
#Name : test_buildtools.py
|
|
3 |
#Part of : Helium
|
|
4 |
|
|
5 |
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
6 |
#All rights reserved.
|
|
7 |
#This component and the accompanying materials are made available
|
|
8 |
#under the terms of the License "Eclipse Public License v1.0"
|
|
9 |
#which accompanies this distribution, and is available
|
|
10 |
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
11 |
#
|
|
12 |
#Initial Contributors:
|
|
13 |
#Nokia Corporation - initial contribution.
|
|
14 |
#
|
|
15 |
#Contributors:
|
|
16 |
#
|
|
17 |
#Description:
|
|
18 |
#===============================================================================
|
|
19 |
"""test ANTwriter """
|
|
20 |
|
|
21 |
import os.path
|
|
22 |
import shutil
|
|
23 |
import unittest
|
|
24 |
|
|
25 |
from buildtools import *
|
|
26 |
|
|
27 |
|
|
28 |
class AntWriterTest(unittest.TestCase):
|
|
29 |
""" Unit test case for AntWriter """
|
|
30 |
def setUp(self):
|
|
31 |
"""called before all tests run to setup variables etc."""
|
|
32 |
self.temp = "temp"
|
628
|
33 |
if not os.path.exists(self.temp):
|
|
34 |
os.makedirs(self.temp)
|
587
|
35 |
|
|
36 |
def tearDown(self):
|
|
37 |
""" called after tests have run to clear anything left hanging around"""
|
|
38 |
shutil.rmtree(self.temp)
|
|
39 |
|
|
40 |
def testOutput(self):
|
|
41 |
"""tests AntWriter output """
|
|
42 |
writer = AntWriter(os.path.join(self.temp, "buildtools_antwriter_test.ant.xml"))
|
|
43 |
commands = CommandList()
|
|
44 |
commands.addCommand(Command(self.temp, "foo"))
|
|
45 |
writer.write(commands)
|
|
46 |
writer.close()
|
|
47 |
|
|
48 |
class MakerWriterTest(unittest.TestCase):
|
|
49 |
""" Unit test case for MakerWriter """
|
|
50 |
def setUp(self):
|
|
51 |
"""called before any tests are run to setup variables etc."""
|
|
52 |
self.temp = "temp"
|
|
53 |
os.makedirs(self.temp)
|
|
54 |
|
|
55 |
def tearDown(self):
|
|
56 |
""" called after tests have run to clear anything left hanging around"""
|
|
57 |
shutil.rmtree(self.temp)
|
|
58 |
|
|
59 |
def testOutput(self):
|
|
60 |
"""test output AntWriter"""
|
|
61 |
writer = AntWriter(os.path.join(self.temp, "buildtools_makewriter_test.mk"))
|
|
62 |
commands = CommandList()
|
|
63 |
commands.addCommand(Command(self.temp, "foo"))
|
|
64 |
writer.write(commands)
|
|
65 |
writer.close()
|
|
66 |
|
|
67 |
if __name__ == "__main__":
|
|
68 |
unittest.main()
|