<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>63479</bug_id>
          
          <creation_ts>2011-06-27 14:03:11 -0700</creation_ts>
          <short_desc>webkitpy unit tests should have more descriptive names than just &quot;Test&quot;</short_desc>
          <delta_ts>2011-06-27 14:59:46 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Barth">abarth</reporter>
          <assigned_to name="Adam Barth">abarth</assigned_to>
          <cc>dpranke</cc>
    
    <cc>eric</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>428266</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-27 14:03:11 -0700</bug_when>
    <thetext>webkitpy unit tests should have more descriptive names than just &quot;Test&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428268</commentid>
    <comment_count>1</comment_count>
      <attachid>98780</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-27 14:04:19 -0700</bug_when>
    <thetext>Created attachment 98780
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428275</commentid>
    <comment_count>2</comment_count>
      <attachid>98780</attachid>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2011-06-27 14:09:40 -0700</bug_when>
    <thetext>Comment on attachment 98780
Patch

The changes look fine, but aren&apos;t the names scoped to the module? I would think it would only be a problem if someone was importing &quot;*&quot; from multiple modules, which is not AFAIK normally done.

Also, I notice that you are deleting the &quot;if __name__ == &apos;__main__&apos; clauses ... as I&apos;ve mentioned before, I use that functionality all the time and would prefer you not delete them unless you had a strong reason to do so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428286</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-27 14:16:54 -0700</bug_when>
    <thetext>&gt; The changes look fine, but aren&apos;t the names scoped to the module?

It depends on how they&apos;re imported.  As it happens, we import them with their fully qualified names, so there&apos;s no conflict.  However, if we imported them all into one flat namespace, we&apos;d get in trouble.

&gt; I would think it would only be a problem if someone was importing &quot;*&quot; from multiple modules, which is not AFAIK normally done.

Yeah, this mostly just code cleanliness patch.  &quot;Test&quot; is just a generic name.

&gt; Also, I notice that you are deleting the &quot;if __name__ == &apos;__main__&apos; clauses ... as I&apos;ve mentioned before, I use that functionality all the time and would prefer you not delete them unless you had a strong reason to do so.

My view is that this is mostly a matter of consistency.  Currently some of the unit tests files have this clause at the bottom and some don&apos;t, which makes it unpredictable whether running the file directly will do anything sensible.

Perhaps the best path forward is to improve test-webkitpy to make it easier to run individual tests?  Currently, you need to pass the fully qualified class name, which is less than ideal.  Something like the gtest_filter is something we could emulate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428289</commentid>
    <comment_count>4</comment_count>
      <attachid>98780</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-27 14:18:35 -0700</bug_when>
    <thetext>Comment on attachment 98780
Patch

Clearing flags on attachment: 98780

Committed r89852: &lt;http://trac.webkit.org/changeset/89852&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428290</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-27 14:18:38 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428300</commentid>
    <comment_count>6</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2011-06-27 14:23:20 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; &gt; The changes look fine, but aren&apos;t the names scoped to the module?
&gt; 
&gt; It depends on how they&apos;re imported.  As it happens, we import them with their fully qualified names, so there&apos;s no conflict.  However, if we imported them all into one flat namespace, we&apos;d get in trouble.
&gt; 
&gt; &gt; I would think it would only be a problem if someone was importing &quot;*&quot; from multiple modules, which is not AFAIK normally done.
&gt; 
&gt; Yeah, this mostly just code cleanliness patch.  &quot;Test&quot; is just a generic name.
&gt; 

Yup, I agree, which is why I approved it :).

&gt; &gt; Also, I notice that you are deleting the &quot;if __name__ == &apos;__main__&apos; clauses ... as I&apos;ve mentioned before, I use that functionality all the time and would prefer you not delete them unless you had a strong reason to do so.
&gt; 
&gt; My view is that this is mostly a matter of consistency.  Currently some of the unit tests files have this clause at the bottom and some don&apos;t, which makes it unpredictable whether running the file directly will do anything sensible.
&gt;

I also agree with this, and have made it a practice in the past to add them where they were missing when I was otherwise changing a file. Of course, if others are practicing the opposite strategy, this can only end in unhappiness.

&gt; Perhaps the best path forward is to improve test-webkitpy to make it easier to run individual tests?  Currently, you need to pass the fully qualified class name, which is less than ideal.  Something like the gtest_filter is something we could emulate.

Possibly; it would certainly be better. In my personal work habits I usually have a shell open and in the directory containing the test files (or maybe one dir up), so &quot;python foo_unittest.py&quot; is easier than &quot;test-webkitpy path-to-test-file&quot; would be, usually (if test-webkitpy was smart enough to figure things out from the current working directory and a relative name, that would be fine). E.g. &apos;test-webkitpy foo&apos; could look for foo_*test.py files in the current working dir.

Also running the tests directly integrates nicely with the python coverage package; it&apos;s been a while since I tried test-webkitpy to see if that also did, but I&apos;d want to preserve that if possible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428304</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-27 14:26:03 -0700</bug_when>
    <thetext>Another issue is that test_webkitpy sets up the environment for the tests.  For example, it configures a bunch of logging settings.  When you run the tests individually, you&apos;re running them in a different environment.

This all just seems like an elaborate workaround for the fact that the tests are slow.  If test-webkitpy ran in zero seconds, there would be no reason not to run the whole suite.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428308</commentid>
    <comment_count>8</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2011-06-27 14:27:24 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; &gt; Perhaps the best path forward is to improve test-webkitpy to make it easier to run individual tests?  Currently, you need to pass the fully qualified class name, which is less than ideal.  Something like the gtest_filter is something we could emulate.
&gt; 
&gt; Possibly; it would certainly be better. In my personal work habits I usually have a shell open and in the directory containing the test files (or maybe one dir up), so &quot;python foo_unittest.py&quot; is easier than &quot;test-webkitpy path-to-test-file&quot; would be, usually (if test-webkitpy was smart enough to figure things out from the current working directory and a relative name, that would be fine). E.g. &apos;test-webkitpy foo&apos; could look for foo_*test.py files in the current working dir.
&gt; 
&gt; Also running the tests directly integrates nicely with the python coverage package; it&apos;s been a while since I tried test-webkitpy to see if that also did, but I&apos;d want to preserve that if possible.

Interesting, I was not aware of the coverage usecase.

Clearly running a test directly with python test.py is differnet from running test-webkitpy.  Both in import constraints as well as logging (there are probably other ways too).  So I&apos;ve been less excited about supporting that mode.

But perhaps there are arguments like the coverage argument which better support this individual mode.

I&apos;d like to either:

- teach webkipy to run them all individually, like you&apos;re proposing doing, and auto-add some sort of main
- remove the ability to run them individually, and instead add all the individual-run features to test-webkitpy

Having two ways to run the tests seems only to end in sadness (like how it&apos;s possible to run them under multiple versions of python does today).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>428340</commentid>
    <comment_count>9</comment_count>
    <who name="Dirk Pranke">dpranke</who>
    <bug_when>2011-06-27 14:59:46 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; Another issue is that test_webkitpy sets up the environment for the tests.  For example, it configures a bunch of logging settings.  When you run the tests individually, you&apos;re running them in a different environment.
&gt; 

This is true, although (a) it rarely seems to matter for me and (b) the environment changes that test-webkitpy does seems to be largely done to work around tests that log more than they should (or log it less controllably). The separate bug that has been open forever about how test-webkitpy configures logging is the right place to debate that, probably.

&gt; This all just seems like an elaborate workaround for the fact that the tests are slow.  If test-webkitpy ran in zero seconds, there would be no reason not to run the whole suite.

I don&apos;t think this is quite true; running the tests (or subsets of tests individually) is useful for debugging why things are failing, and is useful for figuring out test coverage, as I mentioned.

But, assuming you can get that functionality easily enough in test-webkitpy (and I don&apos;t have any reason to think we couldn&apos;t), these differences are just cosmetic.

(In reply to comment #8)
&gt; But perhaps there are arguments like the coverage argument which better support this individual mode.
&gt; 
&gt; I&apos;d like to either:
&gt; 
&gt; - teach webkipy to run them all individually, like you&apos;re proposing doing, and auto-add some sort of main
&gt; - remove the ability to run them individually, and instead add all the individual-run features to test-webkitpy

We definitely need to keep the ability to run individual tests. I don&apos;t care that much what tool does it, but there needs to be a tool that can run a list of specific test methods and even test modules.

&gt; Having two ways to run the tests seems only to end in sadness (like how it&apos;s possible to run them under multiple versions of python does today).

I don&apos;t think the analogy is quite the same, but I agree that we should aim for one tool that meets all the needs (or as many as possible). 

Feel free to add the features to test-webkitpy and then delete all of these lines :)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>98780</attachid>
            <date>2011-06-27 14:04:19 -0700</date>
            <delta_ts>2011-06-27 14:18:34 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-63479-20110627140418.patch</filename>
            <type>text/plain</type>
            <size>3399</size>
            <attacher name="Adam Barth">abarth</attacher>
            
              <data encoding="base64">SW5kZXg6IFRvb2xzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
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