コード例 #1
0
    def test_real_addr(self):
        ## FIXME should choose a port which definitely isn't used.

        ## it's apparently frowned upon to use the "real" reactor in
        ## tests, but I was using "nc" before, and I think this is
        ## preferable.
        from twisted.internet import reactor
        listener = yield TCP4ServerEndpoint(reactor, 9887).listen(FakeProtocolFactory())

        try:
            pid = process_from_address('0.0.0.0', 9887, self.fakestate)
        finally:
            listener.stopListening()

        self.assertEqual(pid, os.getpid())
コード例 #2
0
ファイル: test_util.py プロジェクト: aagbsn/txtorcon
    def test_real_addr(self):
        ## FIXME should choose a port which definitely isn't used.

        ## it's apparently frowned upon to use the "real" reactor in
        ## tests, but I was using "nc" before, and I think this is
        ## preferable.
        from twisted.internet import reactor
        listener = yield TCP4ServerEndpoint(reactor, 9887).listen(FakeProtocolFactory())
        
        try:
            pid = process_from_address('0.0.0.0', 9887, self.fakestate)
        finally:
            listener.stopListening()

        self.assertEqual(pid, os.getpid())
コード例 #3
0
ファイル: test_util.py プロジェクト: zezo010/txtorcon
 def test_internal_no_state(self):
     "look up the (Tor_internal) PID"
     pfa = process_from_address('(Tor_internal)', 80)
     # depends on whether you have psutil installed or not, and on
     # whether your system always has a PID 0 process...
     self.assertEqual(pfa, None)
コード例 #4
0
ファイル: test_util.py プロジェクト: zezo010/txtorcon
 def test_none(self):
     "ensure we do something useful on a None address"
     self.assertEqual(process_from_address(None, 80, self.fakestate), None)
コード例 #5
0
ファイル: test_util.py プロジェクト: aagbsn/txtorcon
 def test_internal(self):
     pfa = process_from_address('(Tor_internal)', 80, self.fakestate)
     # depends on whether you have psutil installed or not, and on
     # whether your system always has a PID 0 process...
     self.assertEqual(pfa, self.fakestate.tor_pid)
コード例 #6
0
ファイル: test_util.py プロジェクト: aagbsn/txtorcon
 def test_none(self):
     self.assertEqual(process_from_address(None, 80, self.fakestate), None)
コード例 #7
0
 def test_internal(self):
     pfa = process_from_address('(Tor_internal)', 80, self.fakestate)
     # depends on whether you have psutil installed or not, and on
     # whether your system always has a PID 0 process...
     self.assertEqual(pfa, self.fakestate.tor_pid)
コード例 #8
0
 def test_none(self):
     self.assertEqual(process_from_address(None, 80, self.fakestate), None)
コード例 #9
0
ファイル: test_util.py プロジェクト: felipedau/txtorcon
 def test_internal_no_state(self):
     "look up the (Tor_internal) PID"
     pfa = process_from_address('(Tor_internal)', 80)
     # depends on whether you have psutil installed or not, and on
     # whether your system always has a PID 0 process...
     self.assertEqual(pfa, None)
コード例 #10
0
ファイル: test_util.py プロジェクト: felipedau/txtorcon
 def test_none(self):
     "ensure we do something useful on a None address"
     self.assertEqual(process_from_address(None, 80, self.fakestate), None)
コード例 #11
0
ファイル: test_util.py プロジェクト: gsathya/txtorcon
 def test_none(self):
     self.assertTrue(process_from_address(None, 80, self.fakestate) == None)