blob: 1d7a0323018b561bcd4f45012b938728cf7b2793 (
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
53
|
import os
import subprocess
import sys
import unittest
from nose.plugins.skip import SkipTest
from nose import commands
from StringIO import StringIO
support = os.path.join(
os.path.dirname(__file__), 'support', 'issue191')
class TestCommands(unittest.TestCase):
def setUp(self):
try:
import setuptools
except ImportError:
raise SkipTest("setuptools not available")
self.dir = os.getcwd()
self.stderr = sys.stderr
os.chdir(support)
def tearDown(self):
os.chdir(self.dir)
sys.stderr = self.stderr
def test_setup_nosetests_command_works(self):
from setuptools.dist import Distribution
buf = StringIO()
sys.stderr = buf
cmd = commands.nosetests(
Distribution(attrs={'script_name': 'setup.py',
'package_dir': {'issue191': support}}))
cmd.finalize_options()
## FIXME why doesn't Config see the chdir above?
print cmd._nosetests__config.workingDir
cmd._nosetests__config.workingDir = support
cmd._nosetests__config.stream = buf
try:
cmd.run()
except SystemExit, e:
self.assertFalse(e.args[0], buf.getvalue())
else:
self.fail("cmd.run() did not exit")
# assert subprocess.call(
# ["python", "setup.py", "nosetests", "2>/dev/null"],
# shell=True) == 0, \
# "python setup.py nosetests in %s failed" % support
if __name__ == '__main__':
unittest.main()
|