Beispiel #1
0
    def test_start_logger(self, mock_twisted_log, mock_twisted_logfile):
        start_logger(True)
        self.assertTrue(mock_twisted_log.is_called)
        mock_twisted_log.startLogging.assert_called_with(sys.stdout)

        start_logger(False)
        YmD_date = datetime.now().strftime('%Y-%m-%d.scrapy.log')
        self.assertTrue(mock_twisted_logfile.is_called)
        mock_twisted_logfile.LogFile.assert_called_with(YmD_date, 'logs/', maxRotatedFiles=100)
Beispiel #2
0
    def test_start_logger(self, mock_twisted_log, mock_twisted_logfile):
        start_logger(True)
        self.assertTrue(mock_twisted_log.is_called)
        mock_twisted_log.startLogging.assert_called_with(sys.stdout)

        start_logger(False)
        y_m_d_date = datetime.now().strftime('%Y-%m-%d.scrapy.log')
        self.assertTrue(mock_twisted_logfile.is_called)
        mock_twisted_logfile.LogFile.assert_called_with(y_m_d_date,
                                                        'logs/',
                                                        maxRotatedFiles=100)
    def test_start_logger(self):
        if SCRAPY_VERSION <= (1, 0, 0):
            with patch('arachne.scrapy_utils.tlog') as mock_twisted_log:
                start_logger(True)
                self.assertTrue(mock_twisted_log.is_called)
                mock_twisted_log.startLogging.assert_called_with(sys.stdout)

            with patch('arachne.scrapy_utils.logfile') as mock_twisted_logfile:
                start_logger(False)
                y_m_d_date = datetime.now().strftime('%Y-%m-%d.scrapy.log')
                self.assertTrue(mock_twisted_logfile.is_called)
                mock_twisted_logfile.LogFile.assert_called_with(
                    y_m_d_date, 'logs/', maxRotatedFiles=100)
Beispiel #4
0
    def test_start_logger(self):
        if SCRAPY_VERSION <= (1, 0, 0):
            with patch('arachne.scrapy_utils.tlog') as mock_twisted_log:
                start_logger(True)
                self.assertTrue(mock_twisted_log.is_called)
                mock_twisted_log.startLogging.assert_called_with(sys.stdout)

            with patch('arachne.scrapy_utils.logfile') as mock_twisted_logfile:
                start_logger(False)
                y_m_d_date = datetime.now().strftime('%Y-%m-%d.scrapy.log')
                self.assertTrue(mock_twisted_logfile.is_called)
                mock_twisted_logfile.LogFile.assert_called_with(
                        y_m_d_date, 'logs/', maxRotatedFiles=100)