Changeset 55970 in webkit


Ignore:
Timestamp:
Mar 13, 2010 2:36:30 PM (14 years ago)
Author:
Chris Jerdonek
Message:

The test-webkitpy script now warns the user if the script is
being run using a Python version different from the minimum
version the webkitpy package was meant to support.

Reviewed by Adam Barth.

https://bugs.webkit.org/show_bug.cgi?id=35788

Warning developers if their Python version is too low will help
them understand why test-webkitpy is failing. Secondly, warning
developers if their Python version is higher than the minimum will
help them understand that their changes may not be okay for the
minimum supported version, even if test-webkitpy is passing.

  • Scripts/test-webkitpy:
    • Moved the "from ..._unittest import *" lines to the new file Scripts/webkitpy/unittests.py. This will allow the version-check warning to be displayed even if an error occurs while interpreting (i.e. importing) the unit test code.
    • Added configure_logging() to configur logging for test-webkitpy.
    • Added an init() method to configure logging and check the current Python version.
  • Scripts/webkitpy/init/unittests.py: Added.
    • Added a file to import all unit test modules in the webkitpy.init package.
  • Scripts/webkitpy/init/versioning.py: Added.
    • Added a _MINIMUM_SUPPORTED_PYTHON_VERSION variable and set it equal to 2.5.
    • Added a compare_version() method to compare the current Python version against a target version.
    • Added a check_version() method to check the current Python version against the current minimum supported version, and to log a warning message if the check fails.
  • Scripts/webkitpy/init/versioning_unittest.py: Added.
    • Added unit tests for the functions in versioning.py.
  • Scripts/webkitpy/style/unittests.py:
    • Fixed/updated a code comment.
  • Scripts/webkitpy/unittests.py: Added.
    • Moved the "from ..._unittest import *" lines from test-webkitpy.
Location:
trunk/WebKitTools
Files:
3 added
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r55969 r55970  
     12010-03-13  Chris Jerdonek  <cjerdonek@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        The test-webkitpy script now warns the user if the script is
     6        being run using a Python version different from the minimum
     7        version the webkitpy package was meant to support.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=35788
     10
     11        Warning developers if their Python version is too low will help
     12        them understand why test-webkitpy is failing.  Secondly, warning
     13        developers if their Python version is higher than the minimum will
     14        help them understand that their changes may not be okay for the
     15        minimum supported version, even if test-webkitpy is passing.
     16
     17        * Scripts/test-webkitpy:
     18          - Moved the "from ..._unittest import *" lines to the new
     19            file Scripts/webkitpy/unittests.py.  This will allow the
     20            version-check warning to be displayed even if an error occurs
     21            while interpreting (i.e. importing) the unit test code.
     22          - Added configure_logging() to configur logging for test-webkitpy.
     23          - Added an init() method to configure logging and check the
     24            current Python version.
     25
     26        * Scripts/webkitpy/init/unittests.py: Added.
     27          - Added a file to import all unit test modules in the
     28            webkitpy.init package.
     29
     30        * Scripts/webkitpy/init/versioning.py: Added.
     31          - Added a _MINIMUM_SUPPORTED_PYTHON_VERSION variable and set
     32            it equal to 2.5.
     33          - Added a compare_version() method to compare the current Python
     34            version against a target version.
     35          - Added a check_version() method to check the current Python
     36            version against the current minimum supported version, and to
     37            log a warning message if the check fails.
     38
     39        * Scripts/webkitpy/init/versioning_unittest.py: Added.
     40          - Added unit tests for the functions in versioning.py.
     41
     42        * Scripts/webkitpy/style/unittests.py:
     43          - Fixed/updated a code comment.
     44
     45        * Scripts/webkitpy/unittests.py: Added.
     46          - Moved the "from ..._unittest import *" lines from test-webkitpy.
     47
    1482010-03-13  Chris Jerdonek  <cjerdonek@webkit.org>
    249
  • trunk/WebKitTools/Scripts/test-webkitpy

    r54830 r55970  
    11#!/usr/bin/env python
    22# Copyright (c) 2009 Google Inc. All rights reserved.
     3# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
    34#
    45# Redistribution and use in source and binary forms, with or without
     
    2829# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2930
     31import logging
    3032import sys
    3133import unittest
    3234
    33 from webkitpy.bugzilla_unittest import *
    34 from webkitpy.buildbot_unittest import *
    35 from webkitpy.changelogs_unittest import *
    36 from webkitpy.commands.download_unittest import *
    37 from webkitpy.commands.early_warning_system_unittest import *
    38 from webkitpy.commands.openbugs_unittest import OpenBugsTest
    39 from webkitpy.commands.upload_unittest import *
    40 from webkitpy.commands.queries_unittest import *
    41 from webkitpy.commands.queues_unittest import *
    42 from webkitpy.committers_unittest import *
    43 from webkitpy.credentials_unittest import *
    44 from webkitpy.diff_parser_unittest import *
    45 from webkitpy.executive_unittest import *
    46 from webkitpy.grammar_unittest import *
    47 from webkitpy.layout_tests.port.mac_unittest import *
    48 from webkitpy.multicommandtool_unittest import *
    49 from webkitpy.networktransaction_unittest import *
    50 from webkitpy.patchcollection_unittest import *
    51 from webkitpy.queueengine_unittest import *
    52 from webkitpy.steps.steps_unittest import *
    53 from webkitpy.steps.closebugforlanddiff_unittest import *
    54 from webkitpy.steps.updatechangelogswithreview_unittests import *
    55 from webkitpy.style.unittests import * # for check-webkit-style
    56 from webkitpy.user_unittest import *
    57 from webkitpy.webkit_logging_unittest import *
    58 from webkitpy.webkitport_unittest import *
     35import webkitpy.init.versioning as versioning
     36
     37_log = logging.getLogger("test-webkitpy")
     38
     39
     40def configure_logging():
     41    """Configure the root logger to log info messages and above."""
     42    handler = logging.StreamHandler(sys.stderr)
     43    formatter = logging.Formatter("[%(levelname)s] %(name)s: %(message)s")
     44    handler.setFormatter(formatter)
     45
     46    logger = logging.getLogger()
     47    logger.setLevel(logging.INFO)
     48    logger.addHandler(handler)
     49
     50
     51def init():
     52    """Execute code prior to importing from webkitpy.unittests."""
     53    configure_logging()
     54
     55    versioning.check_version()
     56
     57    (comparison, current_version, minimum_version) = \
     58        versioning.compare_version()
     59
     60    if comparison > 0:
     61        # Then the current version is later than the minimum version.
     62        message = ("You are testing webkitpy with a Python version (%s) "
     63                   "higher than the minimum version (%s) it was meant "
     64                   "to support." % (current_version, minimum_version))
     65        _log.warn(message)
     66
    5967
    6068if __name__ == "__main__":
    61     # FIXME: This is a hack, but I'm tired of commenting out the test.
    62     #        See https://bugs.webkit.org/show_bug.cgi?id=31818
    63     if len(sys.argv) > 1 and sys.argv[1] == "--all":
    64         sys.argv.remove("--all")
    65         from webkitpy.scm_unittest import *
    6669
     70    init()
     71
     72    # We import the unit test code after init() to ensure that any
     73    # Python version warnings are displayed in case an error occurs
     74    # while interpreting webkitpy.unittests.  This also allows
     75    # logging to be configured prior to importing -- for example to
     76    # enable the display of autoinstall logging.log messages while
     77    # running the unit tests.
     78    from webkitpy.unittests import *
     79
     80    # Runs the unit tests.
    6781    unittest.main()
  • trunk/WebKitTools/Scripts/webkitpy/style/unittests.py

    r55361 r55970  
    3131"""Runs style package unit tests."""
    3232
    33 # This module is imported by test-webkitpy.
     33# This module is imported by the module that imports all webkitpy unit tests.
    3434
    3535import sys
  • trunk/WebKitTools/Scripts/webkitpy/unittests.py

    r55969 r55970  
    55# modification, are permitted provided that the following conditions are
    66# met:
    7 # 
     7#
    88#     * Redistributions of source code must retain the above copyright
    99# notice, this list of conditions and the following disclaimer.
     
    1515# contributors may be used to endorse or promote products derived from
    1616# this software without specific prior written permission.
    17 # 
     17#
    1818# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
     30# This module is imported by Scripts/test-webkitpy.
     31
    3032import sys
    31 import unittest
    3233
    3334from webkitpy.bugzilla_unittest import *
     
    4546from webkitpy.executive_unittest import *
    4647from webkitpy.grammar_unittest import *
     48from webkitpy.init.unittests import *  # for the webkitpy.init package
    4749from webkitpy.layout_tests.port.mac_unittest import *
    4850from webkitpy.multicommandtool_unittest import *
     
    5355from webkitpy.steps.closebugforlanddiff_unittest import *
    5456from webkitpy.steps.updatechangelogswithreview_unittests import *
    55 from webkitpy.style.unittests import * # for check-webkit-style
     57from webkitpy.style.unittests import *  # for the webkitpy.style package
    5658from webkitpy.user_unittest import *
    5759from webkitpy.webkit_logging_unittest import *
    5860from webkitpy.webkitport_unittest import *
    5961
    60 if __name__ == "__main__":
    61     # FIXME: This is a hack, but I'm tired of commenting out the test.
    62     #        See https://bugs.webkit.org/show_bug.cgi?id=31818
    63     if len(sys.argv) > 1 and sys.argv[1] == "--all":
    64         sys.argv.remove("--all")
    65         from webkitpy.scm_unittest import *
    66 
    67     unittest.main()
     62# FIXME: This is a hack, but I'm tired of commenting out the test.
     63#        See https://bugs.webkit.org/show_bug.cgi?id=31818
     64if len(sys.argv) > 1 and sys.argv[1] == "--all":
     65    sys.argv.remove("--all")
     66    from webkitpy.scm_unittest import *
Note: See TracChangeset for help on using the changeset viewer.