python import test fails on modules which need $DISPLAY

Bug #1024346 reported by Victor Zhou
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
auto-upgrade-testing (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

Error message:

ERROR: test_python_import (__main__.TestPython)
Import python modules from /usr/lib/PYTHONVER/dist-packages/
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/test_python_import.py", line 105, in test_python_import
    res &= self._try_import(os.path.join(self.distpackages, module))
  File "/tmp/test_python_import.py", line 83, in _try_import
    pkg = subprocess.check_output(["dpkg", "-S", os.path.realpath(path)])
  File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['dpkg', '-S', '/usr/lib/python2.7/dist-packages/ccm']' returned non-zero exit status 1

Link to the test: https://jenkins.qa.ubuntu.com/view/Precise/view/Upgrade%20Testing%20Dashboard/job/precise-upgrade-lucid-universe/166/ARCH=amd64,LTS=lts,PROFILE=universe,label=upgrade-test/

Revision history for this message
Victor Zhou (victor.zhou) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1024346/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Gema Gomez (gema)
tags: added: rls-p-incoming
affects: ubuntu → python-defaults (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: lucid upgrade to precise universe failed: test python import failed

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-defaults (Ubuntu):
status: New → Confirmed
Revision history for this message
Gema Gomez (gema) wrote :

This bug is holding up lucid to precise upgrades. It should be dealt with as a matter of priority.

Changed in python-defaults (Ubuntu):
importance: Undecided → High
affects: python-defaults (Ubuntu) → ubuntu
Gema Gomez (gema)
tags: removed: rls-p-incoming
Revision history for this message
Martin Pitt (pitti) wrote :

The CalledProcessError is a wart from the test script. I fixed that in

  http://bazaar.launchpad.net/~auto-upgrade-testing-dev/auto-upgrade-testing/trunk/revision/34

now it points out that the file it tries to import is not shipped by any package. Most python modules now ship the python2.7/dist-packages/ files, but some really old ones still use the "create python version specific symlinks at postinst time" approach.

Anyway, this apparently means that compizconfig-settings-manager's ccm module does not work any more after an upgrade to precise.

affects: ubuntu → compizconfig-settings-manager (Ubuntu)
Revision history for this message
Martin Pitt (pitti) wrote :

It is a bit unfortunate that stderr from the redirects is redirected to a "/tmp/....stderr" file which is then not attached as an artifact.

I installed compizconfig-settings-manager in my precise chroot, and with a $DISPLAY the import works just fine. But without a $DISPLAY (which is what happens in the dist-upgrade tester, I suppose) I get

$ DISPLAY= python -c 'import ccm'
Gtk-Message: Failed to load module "overlay-scrollbar"
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/ccm/__init__.py", line 1, in <module>
    from ccm.Conflicts import *
  File "/usr/lib/python2.7/dist-packages/ccm/Conflicts.py", line 26, in <module>
    from ccm.Constants import *
  File "/usr/lib/python2.7/dist-packages/ccm/Constants.py", line 30, in <module>
    CurrentScreenNum = gtk.gdk.display_get_default().get_default_screen().get_number()
AttributeError: 'NoneType' object has no attribute 'get_default_screen'

This will also hit us with thigs like "import gtk" and similar. So I think we should rather run the whole test under xvfb-run, so that modules that need an X server/$DISPLAY will succeed. We also need to fix stderr handling from that test, to add the .stderr file as an artifact.

affects: compizconfig-settings-manager (Ubuntu) → auto-upgrade-testing (Ubuntu)
summary: - lucid upgrade to precise universe failed: test python import failed
+ python import test fails on modules which need $DISPLAY
Revision history for this message
Martin Pitt (pitti) wrote :

Reproducer (also in quantal): Install compizconfig-settings-manager, and then run

$ DISPLAY= share/post_upgrade_tests/test_python_import.py -v
test_python_import (__main__.TestPython)
Import python modules from /usr/lib/PYTHONVER/dist-packages/ ... FAIL

======================================================================
FAIL: test_python_import (__main__.TestPython)
Import python modules from /usr/lib/PYTHONVER/dist-packages/
----------------------------------------------------------------------
Traceback (most recent call last):
  File "share/post_upgrade_tests/test_python_import.py", line 114, in test_python_import
    self.assertTrue(res, '%d module(s) failed to import' % len(self.failed))
AssertionError: 1 module(s) failed to import

Changed in auto-upgrade-testing (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package auto-upgrade-testing - 1:0.164

---------------
auto-upgrade-testing (1:0.164) quantal; urgency=low

  * share/post_upgrade_tests/test_python_import.py: Fix CalledProcessError
    crash when a python module is not shipped by any package any more.
  * share/post_upgrade_tests/test_python_import.py: Run test under xvfb, so
    that modules that need a $DISPLAY (such as ccsm) will not fail. Add xvfb
    dependency for this. (LP: #1024346)
 -- Martin Pitt <email address hidden> Fri, 13 Jul 2012 16:14:37 +0200

Changed in auto-upgrade-testing (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.