Example #1
0
 def test_gcov_flush_fail(self):
     """Test when gcov_flush fails"""
     serv = Server(path=PATH)
     serv.proc = 1
     serv.pid = -300
     with pytest.raises(ServerProcessError):
         serv.gcov_flush()
Example #2
0
 def test_gcov_flush_fail(self):
     """Test when gcov_flush fails"""
     serv = Server(path=PATH)
     serv.proc = 1
     serv.pid = -300
     with pytest.raises(ServerProcessError):
         serv.gcov_flush()
Example #3
0
    def test_gov_flush_fail(self):
        """Test when gov_flush fails"""
        serv = Server(path=PATH)
        serv.proc = Mock(ProcessMonitor)
        serv.proc.send_signal.side_effect = OSError

        with pytest.raises(ServerProcessError):
            serv.gcov_flush()
Example #4
0
    def test_gov_flush_fail(self):
        """Test when gov_flush fails"""
        serv = Server(path=PATH)
        serv.proc = Mock(ProcessMonitor)
        serv.proc.send_signal.side_effect = OSError

        with pytest.raises(ServerProcessError):
            serv.gcov_flush()
Example #5
0
 def test_normal_gcov_flush(self, monkeypatch):
     """Test gcov_flush"""
     serv = Server(path='abc')
     serv.proc = Mock()
     monkeypatch.setattr(os, 'kill', Mock())
     res = serv.gcov_flush()
     assert res is True
     assert serv.proc is not None
Example #6
0
 def test_terminate_cov(self):
     """Test terminate and gcov_flush ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     serv.gcov_flush = Mock()
     serv.make_coverage = Mock()
     with pytest.raises(ServerProcessError):
         serv.terminate(True)
Example #7
0
 def test_normal_gcov_flush(self, monkeypatch):
     """Test gcov_flush"""
     serv = Server(path='abc')
     serv.proc = Mock()
     monkeypatch.setattr(os, 'kill', Mock())
     res = serv.gcov_flush()
     assert res is True
     assert serv.proc is not None
Example #8
0
 def test_terminate_cov(self):
     """Test terminate and gcov_flush ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     serv.gcov_flush = Mock()
     serv.make_coverage = Mock()
     with pytest.raises(ServerProcessError):
         serv.terminate(True)
Example #9
0
 def test_kill_cov(self, monkeypatch):
     """Test kill and gcov_flush ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     serv.gcov_flush = Mock()
     serv.make_coverage = Mock()
     monkeypatch.setattr(os, 'kill', Mock(side_effect=OSError))
     with pytest.raises(ServerProcessError):
         serv.kill(True)
Example #10
0
 def test_kill_cov(self, monkeypatch):
     """Test kill and gcov_flush ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     serv.gcov_flush = Mock()
     serv.make_coverage = Mock()
     monkeypatch.setattr(os, 'kill', Mock(side_effect=OSError))
     with pytest.raises(ServerProcessError):
         serv.kill(True)
Example #11
0
 def test_no_process_gov_flush(self):
     """Test when no process exists and gcov_flush is called"""
     serv = Server(path=PATH)
     with pytest.raises(ServerProcessError):
         serv.gcov_flush()
Example #12
0
 def test_no_process_gov_flush(self):
     """Test when no process exists and gcov_flush is called"""
     serv = Server(path=PATH)
     with pytest.raises(ServerProcessError):
         serv.gcov_flush()