Products.cmfplone: unittest2

Created on 22 Dec 2016  路  26Comments  路  Source: plone/Products.CMFPlone

We're using unittest2 in many packages:

1) we do not need it in packages targetting python 2.7 or 3 only.
2) we do not declare it in several setup.py's as test dependency if Python 2.6 is target.

Action needed! Remove or Declare in:

  • [x] archetypes.multilingual
  • [x] five.pt
  • [x] plone.app.caching
  • [x] plone.app.collection
  • [x] plone.app.content
  • [x] plone.app.contentlisting
  • [x] plone.app.contenttypes
  • [x] plone.app.debugtoolbar
  • [x] plone.app.discussion
  • [x] plone.app.intid
  • [x] plone.app.iterate
  • [x] plone.app.linkintegrity
  • [x] plone.app.multilingual
  • [x] plone.app.openid
  • [x] plone.app.portlets
  • [x] plone.app.querystring
  • [x] plone.app.redirector
  • [x] plone.app.registry
  • [x] plone.app.relationfield
  • [x] plone.app.testing
  • [x] plone.app.theming
  • [x] plone.app.uuid
  • [x] plone.app.vocabularies
  • [x] plone.autoform
  • [x] plone.openid See https://github.com/plone/plone.openid/pull/8
  • [x] plone.outputfilters
  • [x] plone.portlet.collection
  • [x] plone.portlet.static
  • [x] plone.protect
  • [x] plone.resource (declared)
  • [x] plone.resourceeditor
  • [x] plone.subrequest
  • [x] plone.theme
  • [x] plone.transformchain
  • [x] Products.CMFPlone (removed)
enhancement help in-progress normal easy

Most helpful comment

Seems like Plone is free from unittest2 now!

All 26 comments

do you have information on which packages are still being used in Python 2.6? are we properly using trove classifiers?

I would double check. Iirc @mauritsvanrees did a great job of adding classifiers, I am just not sure if it's been complete.

So I would check the sources.cfg of buildout.coredev 4.3 branch as well.

I have added the trove classifiers a while ago. It could be that some have gotten out of sync. Best place to check is indeed coredev 4.3 sources.cfg.

For reference, these are the extra functions in unittest2 and in the unittest of Python 2.7 that are not in Python 2.6 (ignoring some underscore methods):

addTypeEqualityFunc
assertDictContainsSubset
assertDictEqual
assertGreater
assertGreaterEqual
assertIn
assertIs
assertIsInstance
assertIsNone
assertIsNot
assertIsNotNone
assertItemsEqual
assertLess
assertLessEqual
assertListEqual
assertMultiLineEqual
assertNotIn
assertNotIsInstance
assertNotRegexpMatches
assertRaisesRegexp
assertRegexpMatches
assertSequenceEqual
assertSetEqual
assertTupleEqual
doCleanups
longMessage
maxDiff
setUpClass
skipTest
tearDownClass

So if a package is not using any of those, we can remove the unittest2 dependency.
And if the master branch of a package is not used on Plone 4.3, we can remove the dependency as well.

Some packages include the dependency only for Python 2.6 (like diazo -> https://github.com/plone/diazo/blob/master/setup.py). I guess this is a good aproach for shared packages Plone 4.3 and 5.0

@tomgross that's quite handy indeed, I would rather use this approach on all other packages as well, so we are sure that we are not pulling unittest2 from 2.7 onwards.

Still low hanging fruit, perfect for newcomers or when you have some hours to kill :-)

Can I do this? @gforcada @jensens

@kakshay21 sure, this would be great! Do you need any directions?

@kakshay21 yes please! Let us know if you have problems, either here or on community.plone.org. Go go go!

Can i go little slowly on this one??
Actually, I'm in the middle of my semester end exams. But I really want to do this.
@jensens @gforcada

@kakshay21 you can go as fast or as slow as you wish, one pull request at a time is the best thing to do 馃憤

So many already are done! A big thanks @kakshay21

Appreciate your help @jensens @gforcada

I'm not able to find any repository with name "plone.portlet" neither mr.developer
mr.developer: The package 'plone.portlet' from auto-checkout has no source information.
@jensens @gforcada

We do have plone.portlets, but that does not use unittest2 at all.
Ah, I see that plone.portlet.collection and plone.portlet.static use unittest2. I have updated the original list with them.

thanks! @mauritsvanrees

is there something wrong with naming plone.theme.tests ?
I'm not able to find this repo

Seems like Plone is free from unittest2 now!

plone.theme.tests would be the plone.theme package. I indeed see unittest2 in there. (I updated the main list).

I think, yeah! Now it is unittest2 free!

Last task: remove traces (also its dependencies) of unittest2 from buildout.coredev *.cfg files!

Great work!
I see plone.formwidget.contenttree and plone.formwidget.datetime that still require unittest2 unconditionally. Well, they are not in the sources.cfg of Plone 5.1, so that may be fine.

Apart from those, when I grep through the 5.1 code, I still see real use of unittest2 in:

  • plone.app.contentlisting
  • plone.app.debugtoolbar
  • plone.openid
  • plone.resource

Of these, plone.app.debugtoolbar was missing from the original list. The other three are in there and have a checkbox claiming they have been fixed. I have updated the list to reflect the current situation.

unittest2 is only mentioned in this file.
https://github.com/plone/buildout.coredev/blob/5.1/tests.cfg
there is no master branch so do i have to make changes only in 5.1 branches?
or in 5.0 too?

only in 5.1
at https://github.com/plone/buildout.coredev/blob/5.1/tests.cfg#L200-L213 there are also versions comments giving hints which packages need to get removed from version pins as well.

@jensens linecache2, traceback2 Do we need to remove these as well?
@mauritsvanrees I don't see any usage of unittest2 in

  • plone.app.contentlisting

  • plone.openid

  • plone.resource
    Are these removed? or I'm doing some mistake?

@kakshay21 on plone.openid there is still an import for it, but as it is no longer part of plone core (not used in 5.1 nor in 5.2) it can be safely ignored. On the others you are right, there were some pull requests a few weeks/months ago that cleaned them up.

Great work! Thanks our get-rid-of-unittest2-hero @kakshay21 and all others who helped to make it happen!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mauritsvanrees picture mauritsvanrees  路  4Comments

djay picture djay  路  6Comments

pbauer picture pbauer  路  6Comments

erral picture erral  路  3Comments

skleinfeldt picture skleinfeldt  路  5Comments