~parthpanchl/gtg/design-prototype

« back to all changes in this revision

Viewing changes to GTG/tests/test_apidocs.py

  • Committer: Nimit Shah
  • Date: 2014-03-10 03:37:32 UTC
  • mfrom: (1360.2.18 test-cleanup)
  • Revision ID: nimit.svnit@gmail.com-20140310033732-n4od1z8npybs4ooc
Rework of test-suite, by Izidor Matušov

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
# -----------------------------------------------------------------------------
3
 
# Getting Things GNOME! - a personal organizer for the GNOME desktop
4
 
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
5
 
#
6
 
# This program is free software: you can redistribute it and/or modify it under
7
 
# the terms of the GNU General Public License as published by the Free Software
8
 
# Foundation, either version 3 of the License, or (at your option) any later
9
 
# version.
10
 
#
11
 
# This program is distributed in the hope that it will be useful, but WITHOUT
12
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 
# details.
15
 
#
16
 
# You should have received a copy of the GNU General Public License along with
17
 
# this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
# -----------------------------------------------------------------------------
19
 
 
20
 
""" Tests for the documentation. """
21
 
 
22
 
import unittest
23
 
 
24
 
import subprocess
25
 
import GTG
26
 
import os.path
27
 
import shutil
28
 
import uuid
29
 
 
30
 
 
31
 
class TestApiDocs(unittest.TestCase):
32
 
    """ Test if the documentation still builds. """
33
 
 
34
 
    def test_pydoctor(self):
35
 
        if int(subprocess.call(['which', 'pydoctor'], stdout=subprocess.PIPE)):
36
 
            # if no pydoctor is present, abort the test w/out giving error
37
 
            return
38
 
        GTG_basedir = os.path.dirname(GTG.__file__)
39
 
        api_dir = os.path.join(GTG_basedir, '..', 'tmp',
40
 
                               'test_build_api-' + str(uuid.uuid4()))
41
 
        if not os.path.isdir(api_dir):
42
 
            os.makedirs(api_dir)
43
 
        args = ['pydoctor',
44
 
                '--add-package', GTG_basedir,
45
 
                '--make-html',
46
 
                '--html-output=' + api_dir,
47
 
                '--project-name=GTG',
48
 
                '--project-url=http://gtg.fritalk.com/']
49
 
        # we suppress printing of errors to keep a clean output
50
 
        assert(int(subprocess.call(args,
51
 
                                   stdout=subprocess.PIPE,
52
 
                                   stderr=subprocess.PIPE)) == 0)
53
 
        shutil.rmtree(api_dir)
54
 
 
55
 
 
56
 
def test_suite():
57
 
    return unittest.TestLoader().loadTestsFromTestCase(TestApiDocs)