Changeset 70103 in webkit


Ignore:
Timestamp:
Oct 19, 2010 4:02:49 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-10-19 Eric Seidel <eric@webkit.org>

Unreviewed, just fixing test-webkitpy. I'm really on a roll today.

commit-queue gets stuck when release-patch returns 404
https://bugs.webkit.org/show_bug.cgi?id=47935

Fix test-webkitpy and unittest NetworkTransaction.

  • Scripts/webkitpy/common/net/networktransaction.py:
  • Scripts/webkitpy/common/net/networktransaction_unittest.py:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r70096 r70103  
     12010-10-19  Eric Seidel  <eric@webkit.org>
     2
     3        Unreviewed, just fixing test-webkitpy.  I'm really on a roll today.
     4
     5        commit-queue gets stuck when release-patch returns 404
     6        https://bugs.webkit.org/show_bug.cgi?id=47935
     7
     8        Fix test-webkitpy and unittest NetworkTransaction.
     9
     10        * Scripts/webkitpy/common/net/networktransaction.py:
     11        * Scripts/webkitpy/common/net/networktransaction_unittest.py:
     12
    1132010-10-19  Eric Seidel  <eric@webkit.org>
    214
  • trunk/WebKitTools/Scripts/webkitpy/common/net/networktransaction.py

    r70092 r70103  
    4646        self._grown_factor = grown_factor
    4747        self._timeout_seconds = timeout_seconds
     48        self._convert_404_to_None = convert_404_to_None
    4849
    4950    def run(self, request):
     
    5556            # FIXME: We should catch urllib2.HTTPError here too.
    5657            except mechanize.HTTPError, e:
    57                 if convert_404_to_None and e.code == 404:
     58                if self._convert_404_to_None and e.code == 404:
    5859                    return None
    5960                self._check_for_timeout()
  • trunk/WebKitTools/Scripts/webkitpy/common/net/networktransaction_unittest.py

    r56988 r70103  
    5757        self.assertTrue(did_process_exception)
    5858
    59     def _raise_http_error(self):
     59    def _raise_500_error(self):
    6060        self._run_count += 1
    6161        if self._run_count < 3:
    62             raise HTTPError("http://example.com/", 500, "inteneral server error", None, None)
     62            raise HTTPError("http://example.com/", 500, "internal server error", None, None)
    6363        return 42
     64
     65    def _raise_404_error(self):
     66        raise HTTPError("http://foo.com/", 404, "not found", None, None)
    6467
    6568    def test_retry(self):
    6669        self._run_count = 0
    6770        transaction = NetworkTransaction(initial_backoff_seconds=0)
    68         self.assertEqual(transaction.run(lambda: self._raise_http_error()), 42)
     71        self.assertEqual(transaction.run(lambda: self._raise_500_error()), 42)
    6972        self.assertEqual(self._run_count, 3)
    7073        self.assertLog(['WARNING: Received HTTP status 500 from server.  '
     
    7275                        'WARNING: Received HTTP status 500 from server.  '
    7376                        'Retrying in 0.0 seconds...\n'])
     77
     78    def test_convert_404_to_None(self):
     79        transaction = NetworkTransaction(convert_404_to_None=True)
     80        self.assertEqual(transaction.run(lambda: self._raise_404_error()), None)
    7481
    7582    def test_timeout(self):
     
    7986        did_throw_exception = True
    8087        try:
    81             transaction.run(lambda: self._raise_http_error())
     88            transaction.run(lambda: self._raise_500_error())
    8289            did_throw_exception = False
    8390        except NetworkTimeout, e:
Note: See TracChangeset for help on using the changeset viewer.