소스 검색

Remove unused variables

Mike Naberezny 11 년 전
부모
커밋
a19612aa3e

+ 2 - 2
supervisor/scripts/loop_eventgen.py

@@ -14,7 +14,7 @@ def main(max):
     i = 0
     while 1:
         childutils.pcomm.stdout('the_data')
-        data = sys.stdin.readline()
+        sys.stdin.readline()
         report.write(str(i) + ' @ %s\n' % childutils.get_asctime())
         report.flush()
         i+=1
@@ -28,5 +28,5 @@ if __name__ == '__main__':
     if len(sys.argv) > 1:
         max = int(sys.argv[1])
     main(max)
-        
+
 

+ 3 - 4
supervisor/tests/test_childutils.py

@@ -8,6 +8,7 @@ class ChildUtilsTests(unittest.TestCase):
         from supervisor.childutils import getRPCInterface
         rpc = getRPCInterface({'SUPERVISOR_SERVER_URL':'http://localhost:9001'})
         # we can't really test this thing; its a magic object
+        self.assertTrue(rpc is not None)
 
     def test_getRPCTransport_no_uname_pass(self):
         from supervisor.childutils import getRPCTransport
@@ -67,7 +68,7 @@ class TestProcessCommunicationsProtocol(unittest.TestCase):
             self.assertEqual(io.getvalue(), '%s%s%s' % (begin, 'hello', end))
         finally:
             sys.stdout = old
-        
+
     def test_stderr(self):
         from supervisor.childutils import pcomm
         old = sys.stderr
@@ -84,8 +85,6 @@ class TestProcessCommunicationsProtocol(unittest.TestCase):
 class TestEventListenerProtocol(unittest.TestCase):
     def test_wait(self):
         from supervisor.childutils import listener
-        from supervisor.dispatchers import PEventListenerDispatcher
-        token = PEventListenerDispatcher.READY_FOR_EVENTS_TOKEN
         class Dummy:
             def readline(self):
                 return 'len:5'
@@ -131,7 +130,7 @@ class TestEventListenerProtocol(unittest.TestCase):
         listener.send(msg, stdout)
         expected = '%s%s\n%s' % (begin, len(msg), msg)
         self.assertEqual(stdout.getvalue(), expected)
-        
+
 
 def test_suite():
     return unittest.findTestCases(sys.modules[__name__])

+ 0 - 2
supervisor/tests/test_http.py

@@ -47,7 +47,6 @@ class LogtailHandlerTests(HandlerTests, unittest.TestCase):
         self.assertEqual(request._error, 410)
 
     def test_handle_request_stdout_logfile_missing(self):
-        supervisor = DummySupervisor()
         options = DummyOptions()
         pconfig = DummyPConfig(options, 'foo', 'foo', 'it/is/missing')
         supervisord = PopulatedDummySupervisor(options, 'foo', pconfig)
@@ -57,7 +56,6 @@ class LogtailHandlerTests(HandlerTests, unittest.TestCase):
         self.assertEqual(request._error, 410)
 
     def test_handle_request(self):
-        supervisor = DummySupervisor()
         import tempfile
         import os
         import stat

+ 3 - 4
supervisor/tests/test_process.py

@@ -554,7 +554,7 @@ class SubprocessTests(unittest.TestCase):
         sent = 'a' * (1 << 13)
         self.assertRaises(OSError, instance.write, sent)
         options.forkpid = 1
-        result = instance.spawn()
+        instance.spawn()
         instance.write(sent)
         stdin_fd = instance.pipes['stdin']
         self.assertEqual(sent, instance.dispatchers[stdin_fd].input_buffer)
@@ -569,7 +569,7 @@ class SubprocessTests(unittest.TestCase):
         sent = 'a' * (1 << 13)
         self.assertRaises(OSError, instance.write, sent)
         options.forkpid = 1
-        result = instance.spawn()
+        instance.spawn()
         stdin_fd = instance.pipes['stdin']
         instance.dispatchers[stdin_fd].close()
         self.assertRaises(OSError, instance.write, sent)
@@ -582,7 +582,7 @@ class SubprocessTests(unittest.TestCase):
         sent = 'a' * (1 << 13)
         self.assertRaises(OSError, instance.write, sent)
         options.forkpid = 1
-        result = instance.spawn()
+        instance.spawn()
         stdin_fd = instance.pipes['stdin']
         instance.dispatchers[stdin_fd].flush_error = errno.EPIPE
         self.assertRaises(OSError, instance.write, sent)
@@ -1664,7 +1664,6 @@ class EventListenerPoolTests(ProcessGroupBaseTests):
         pool.transition()
         self.assertEqual(process1.transitioned, True)
         self.assertEqual(pool.event_buffer, [event])
-        data = pool.config.options.logger.data
 
     def test_transition_event_proc_not_running(self):
         options = DummyOptions()

+ 2 - 2
supervisor/tests/test_rpcinterfaces.py

@@ -474,7 +474,7 @@ class SupervisorNamespaceXMLRPCInterfaceTests(TestBase):
         supervisord.set_procattr('process1', 'state', ProcessStates.STOPPED)
         supervisord.set_procattr('process2', 'state', ProcessStates.STOPPED)
         interface = self._makeOne(supervisord)
-        callback = interface.startProcess('foo:*')
+        interface.startProcess('foo:*')
         self.assertEqual(interface.update_text, 'startProcessGroup')
 
     def test_startProcessGroup(self):
@@ -777,7 +777,7 @@ class SupervisorNamespaceXMLRPCInterfaceTests(TestBase):
         supervisord.set_procattr('process1', 'state', ProcessStates.STOPPED)
         supervisord.set_procattr('process2', 'state', ProcessStates.STOPPED)
         interface = self._makeOne(supervisord)
-        callback = interface.stopProcess('foo:*')
+        interface.stopProcess('foo:*')
         self.assertEqual(interface.update_text, 'stopProcessGroup')
 
     def test_stopAllProcesses(self):

+ 1 - 1
supervisor/tests/test_socket_manager.py

@@ -176,7 +176,7 @@ class SocketManagerTest(unittest.TestCase):
         sock = sock_manager.get_socket()
         sock_manager2 = self._makeOne(conf)
         self.assertRaises(socket.error, sock_manager2.get_socket)
-        sock = None
+        del sock
 
     def test_unix_bad_sock(self):
         conf = UnixStreamSocketConfig('/notthere/foo.sock')

+ 0 - 3
supervisor/tests/test_supervisord.py

@@ -434,7 +434,6 @@ class SupervisordTests(unittest.TestCase):
         options = DummyOptions()
         supervisord = self._makeOne(options)
         pconfig = DummyPConfig(options, 'foo', '/bin/foo',)
-        process = DummyProcess(pconfig)
         gconfig = DummyPGroupConfig(options, pconfigs=[pconfig])
         pgroup = DummyProcessGroup(gconfig)
         readable = DummyDispatcher(readable=True)
@@ -454,7 +453,6 @@ class SupervisordTests(unittest.TestCase):
         options = DummyOptions()
         supervisord = self._makeOne(options)
         pconfig = DummyPConfig(options, 'foo', '/bin/foo',)
-        process = DummyProcess(pconfig)
         gconfig = DummyPGroupConfig(options, pconfigs=[pconfig])
         pgroup = DummyProcessGroup(gconfig)
         from supervisor.medusa import asyncore_25 as asyncore
@@ -490,7 +488,6 @@ class SupervisordTests(unittest.TestCase):
         options = DummyOptions()
         supervisord = self._makeOne(options)
         pconfig = DummyPConfig(options, 'foo', '/bin/foo',)
-        process = DummyProcess(pconfig)
         gconfig = DummyPGroupConfig(options, pconfigs=[pconfig])
         pgroup = DummyProcessGroup(gconfig)
         L = []