[wp-trac] [WordPress Trac] #29827: Leftover taxonomies break later tests

WordPress Trac noreply at wordpress.org
Thu Oct 2 03:03:56 UTC 2014


#29827: Leftover taxonomies break later tests
------------------------------+-----------------------------
 Reporter:  boonebgorges      |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:  2nd-opinion
  Focuses:                    |
------------------------------+-----------------------------
 A number of our tests call `register_taxonomy()`. To make sure the global
 scope is cleared up for the next test, these tests manually call
 `_unregister_taxonomy()`. However, when a test fails before it's had a
 chance to unregister the custom taxonomy, the global remains polluted.
 This can break later tests.

 The most surefire solution is to reset taxonomies to the default as part
 of every `setUp()`. See attached patch. It adds a little overhead, but not
 much - 2-3% more time to run the suite, in my limited testing. Added
 benefit: no need to call _unregister_taxonomy() manually.

 If we don't like the performance hit, a better-than-nothing solution is to
 move calls to `_unregister_taxonomy()` so that they're called before
 assertions, wherever possible. That way, if the test fails, at least it's
 cleaned up its mess first.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29827>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list