Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all test classes from Pharo?

I am using Pharo and I want to shrink image size by safely removing all the Test classes, which I don't need them for my production image. I guess that image size could decrease considerably.

I have tried using Monticello Browser but there is no way to select multiple packages. Anyone tried?

like image 929
user183928 Avatar asked Mar 13 '15 06:03

user183928


1 Answers

You can easily write your own code to remove test classes, but did you have a look at the ImageCleaner class and it's cleanUpForProduction method? It does not only remove test packages but also other code you will not need in your production image like help and example packages.

If you take a look at it's testPackages method you can see:

^(RPackageOrganizer default  packageNames select: [ :each | each endsWith: 'Tests' ]) copyWithout: 'ReleaseTests'

Once you have all the test packages you can remove them:

testPackages do: [ :each | (MCPackage named: each) unload ].

In addition you could look for all remaining subclasses of TestCase.

like image 51
MartinW Avatar answered Oct 11 '22 03:10

MartinW