Fix mis-merge: This test moved to test_run.py
This commit is contained in:
parent
66d40527d1
commit
15312009ce
|
@ -12,13 +12,11 @@ if PY2:
|
||||||
|
|
||||||
from six.moves import cStringIO as StringIO
|
from six.moves import cStringIO as StringIO
|
||||||
import re
|
import re
|
||||||
from six import ensure_text, ensure_str
|
from six import ensure_text
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
from mock import patch
|
|
||||||
from urllib.parse import quote as url_quote
|
from urllib.parse import quote as url_quote
|
||||||
|
|
||||||
from twisted.python.filepath import FilePath
|
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from twisted.internet.testing import (
|
from twisted.internet.testing import (
|
||||||
MemoryReactor,
|
MemoryReactor,
|
||||||
|
@ -1324,30 +1322,3 @@ class Options(ReallyEqualMixin, unittest.TestCase):
|
||||||
["--node-directory=there", "run", some_twistd_option])
|
["--node-directory=there", "run", some_twistd_option])
|
||||||
self.failUnlessRaises(usage.UsageError, self.parse,
|
self.failUnlessRaises(usage.UsageError, self.parse,
|
||||||
["run", "--basedir=here", some_twistd_option])
|
["run", "--basedir=here", some_twistd_option])
|
||||||
|
|
||||||
|
|
||||||
class Run(unittest.TestCase):
|
|
||||||
|
|
||||||
@patch('allmydata.scripts.tahoe_run.os.chdir')
|
|
||||||
@patch('allmydata.scripts.tahoe_run.twistd')
|
|
||||||
def test_non_numeric_pid(self, mock_twistd, chdir):
|
|
||||||
"""
|
|
||||||
If the pidfile exists but does not contain a numeric value, a complaint to
|
|
||||||
this effect is written to stderr.
|
|
||||||
"""
|
|
||||||
basedir = FilePath(ensure_str(self.mktemp()))
|
|
||||||
basedir.makedirs()
|
|
||||||
basedir.child(u"twistd.pid").setContent(b"foo")
|
|
||||||
basedir.child(u"tahoe-client.tac").setContent(b"")
|
|
||||||
|
|
||||||
config = tahoe_run.RunOptions()
|
|
||||||
config.stdout = StringIO()
|
|
||||||
config.stderr = StringIO()
|
|
||||||
config['basedir'] = ensure_text(basedir.path)
|
|
||||||
config.twistd_args = []
|
|
||||||
|
|
||||||
result_code = tahoe_run.run(config)
|
|
||||||
self.assertIn("invalid PID file", config.stderr.getvalue())
|
|
||||||
self.assertTrue(len(mock_twistd.mock_calls), 1)
|
|
||||||
self.assertEqual(mock_twistd.mock_calls[0][0], 'runApp')
|
|
||||||
self.assertEqual(0, result_code)
|
|
||||||
|
|
Loading…
Reference in New Issue