587
|
1 |
#============================================================================
|
|
2 |
#Name : test_docs.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 |
|
|
20 |
import unittest
|
|
21 |
import docs
|
|
22 |
import logging
|
|
23 |
import amara
|
|
24 |
import os
|
|
25 |
import sys
|
|
26 |
from cStringIO import StringIO
|
|
27 |
|
|
28 |
_logger = logging.getLogger('test.docs')
|
|
29 |
logging.basicConfig(level=logging.INFO)
|
|
30 |
|
|
31 |
class DocsTest(unittest.TestCase):
|
|
32 |
""" Unit test case for docs.py """
|
|
33 |
def test_find_python_dependencies(self):
|
|
34 |
""" Verifying find_python_dependencies method """
|
|
35 |
|
|
36 |
old_stdout = sys.stdout
|
|
37 |
sys.stdout = mystdout = StringIO()
|
|
38 |
|
|
39 |
setpath = os.path.join(os.environ['TEST_DATA'], 'data', 'docs', 'helium', 'tools')
|
|
40 |
|
|
41 |
print "Searching under " + setpath
|
|
42 |
|
|
43 |
dbPath = os.path.join(os.environ['TEST_DATA'], 'data', 'docs', 'database_test.xml')
|
|
44 |
dbPath = 'file:///'+ dbPath.replace('\\', '/')
|
|
45 |
dbPrj = amara.parse(dbPath)
|
|
46 |
|
|
47 |
docs.find_python_dependencies(setpath, dbPath, dbPrj)
|
|
48 |
|
|
49 |
sys.stdout = old_stdout
|
|
50 |
assert mystdout.getvalue().find("Python module : ant") != -1
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|