Bug 1119172 - pthreading.monkey_patch is too late when done in the vdsm tests
Summary: pthreading.monkey_patch is too late when done in the vdsm tests
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: python-pthreading
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Yaniv Bronhaim
QA Contact: Jiri Belka
Ruediger Landmann
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-14 08:21 UTC by Yaniv Bronhaim
Modified: 2016-04-20 01:28 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-20 01:28:06 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 30022 0 master MERGED tests: Separate test runner from test library Never

Description Yaniv Bronhaim 2014-07-14 08:21:20 UTC
Description of problem:
The introduction of the condition [1] that fail with exception while module thread is being imported before monkey patch it, raised that exception while noisetests starts up. One of nose imports import thread before we manage to call the monkey patch function in python-pthreading

[1] https://github.com/oVirt/pthreading/commit/490e837e0afed37823803d9e180a5d3eb17cb82c

Comment 1 Nir Soffer 2014-07-14 08:30:47 UTC
Monkey patching in the testrunner is too late - we need to monkey patch using something like site.py or other means that perform the monkeypatch first thing before importing anything else.

One option is to have our own nosetest executable:

 1 #!/usr/bin/python                                                                                                                                                                                              
  2 # EASY-INSTALL-ENTRY-SCRIPT: 'nose==1.3.3','console_scripts','nosetests'
  3 __requires__ = 'nose==1.3.3'
  4 import sys

Here we can import pthreading and monkey patch.

  5 from pkg_resources import load_entry_point
  6 
  7 if __name__ == '__main__':
  8     sys.exit(
  9         load_entry_point('nose==1.3.3', 'console_scripts', 'nosetests')()
 10     )

Comment 2 Nir Soffer 2014-07-14 12:47:42 UTC
Turns out that the issue was importing and running pthreading.monkey_patch twice in the tests, because we used testrunner both as script and library. The attached patch fixes this issue.

Comment 3 Jiri Belka 2014-09-17 09:32:35 UTC
CodeChange only or is it easy for a verification? If the latter please provide steps for verification. Thx.

Comment 4 Jiri Belka 2014-09-17 10:58:47 UTC
this is not really testable by QA, it is code change in devel nose tests.


Note You need to log in before you can comment on or make changes to this bug.