Fix mis-merge: This test moved to test_run.py

This commit is contained in:
Jean-Paul Calderone 2021-08-11 12:58:51 -04:00
parent 66d40527d1
commit 15312009ce
1 changed files with 1 additions and 30 deletions

View File

@ -12,13 +12,11 @@ if PY2:
from six.moves import cStringIO as StringIO
import re
from six import ensure_text, ensure_str
from six import ensure_text
import os.path
from mock import patch
from urllib.parse import quote as url_quote
from twisted.python.filepath import FilePath
from twisted.trial import unittest
from twisted.internet.testing import (
MemoryReactor,
@ -1324,30 +1322,3 @@ class Options(ReallyEqualMixin, unittest.TestCase):
["--node-directory=there", "run", some_twistd_option])
self.failUnlessRaises(usage.UsageError, self.parse,
["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)