Fix AppDomain unload issue

Environment

  • Pythonnet version: develop
  • Python version: All
  • Operating System: All

Details

Embedded tests have started taking longer after pytuple tests were added. This is causes embedded tests to finish with Unable to unload AppDomain, Unload thread timed out albeit, still pass the tests.

TestPyTupleInvalidAppend in particular causes the issue to happen consistently on both AppVeyor and Travis, on all Python versions.

Otherwise, the issue occurs sporadically and seems to mostly affect PY27

Error can be seen here:

https://ci.appveyor.com/project/pythonnet/pythonnet/build/master-484/job/69u22p6s8ruxtb2o#L248
https://travis-ci.org/vmuriart/pythonnet/jobs/203804545#L1452