[Plone] Removing unittest2

The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. [1]

Unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7 and onwards. It is tested to run on Python 2.6, 2.7, 3.2, 3.3, 3.4 and pypy.

As stated on this IssueReport on github, Plone no longer needs it in packages targeted for python 2.7 or 3 only and we no longer have to declare it in several setup.py’s as test dependency if Python 2.6 is target. There are still a lot of packages that still have unittest2 in their codes and need to be patched as outlined on the aforementioned issue. I guess I should patch some 🙂

Here are the steps I followed:

Setting up Your Development Environment

First you need to setup a development Environment for testing. We can’t make any changes without properly testing each package we make assuring that it doesn’t break anything. The process of making a Development Environment is outlined in the heading above. It took like 2 hours to complete cause I have a shitty internet connection 1Mb  😥

Now you need to get the source of the package with mr.developer and the checkout command, or you can go directly to editing checkouts.cfg(The method I used).

Screenshot from 2017-03-15 08:11:48

Then rerun buildout to get the source packages:

./bin/buildout

Editing

Now do the required changes.

After editing it was time for testing, the development environment already have the necessary tools to do a local test and check if the changes isn’t breaking anything.

Two tests need to be done:

i) Testing the edited module

In your buildouts folder run:

./bin/test -m plone.app.openid
smalltest

Successful Phase 1 testing

As shown on the screenshot the test was successful without any errors occurring.

Next is the second testing phase

ii) Testing if the edited module didn’t break any other modules.

./bin/alltests
Screenshot from 2017-03-14 18:54:10

Second Phase testing: Got one error

As far as I understood what it meant, this error wasn’t related to the changes I made cause even using the default openid package the error still occurs so I can safely commit my changes.

Screenshot from 2017-03-15 09:39:31.png

The changes were committed and a pull request was made. Hopefully it will get accepted.

One thought on “[Plone] Removing unittest2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s