summaryrefslogtreecommitdiff
path: root/testrepository/tests/test_setup.py
blob: fdddb81672dc2a236c7487fba20ab68e1eac6e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# Copyright (c) 2009 Testrepository Contributors
# 
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
# license you chose for the specific language governing permissions and
# limitations under that license.

"""Tests for setup.py."""

import doctest
import os.path
import subprocess
import sys

from testtools import (
    TestCase,
    )
from testtools.matchers import (
    DocTestMatches,
    MatchesAny,
    )

class TestCanSetup(TestCase):

    def test_bdist(self):
        # Single smoke test to make sure we can build a package.
        path = os.path.join(os.path.dirname(__file__), '..', '..', 'setup.py')
        proc = subprocess.Popen([sys.executable, path, 'bdist'],
            stdin=subprocess.PIPE, stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT, universal_newlines=True)
        output, err = proc.communicate()
        self.assertThat(output, MatchesAny(
            # win32
            DocTestMatches("""...
running install_scripts
...
adding '...testr'
...""", doctest.ELLIPSIS),
            # unixen
            DocTestMatches("""...
...bin/testr ...
""", doctest.ELLIPSIS)
            ))
        self.assertEqual(0, proc.returncode,
            "Setup failed out=%r err=%r" % (output, err))