unittest discover crashes with: module incorrectly imported from 'xxx'. Expected 'xxx. Is this module globally installed?

Bug #1255505 reported by Timo Jyrinki
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Python
Invalid
Unknown
python2.7 (Ubuntu)
Fix Released
Critical
Martin Pitt

Bug Description

I got the similar error on touch device as well today morning before I reflashed it.

sudo apt-get install unity-autopilot
autopilot run unity.tests.test_panel.PanelCrossMonitorsTests.test_hovering_indicators_on_multiple_monitors

On touch I used:
[unknown what I had done before on the device]
adb shell
apt-get install unity8-autopilot
exit
phablet-test-run -n unity8

There the error message was the same except for module+directories referring to unity8.

I've verified that at least Python 2.7 2.7.5-8ubuntu4 works as intended, and 2.7.6-2 is broken.

ProblemType: Crash
DistroRelease: Ubuntu 14.04
Package: python-autopilot 1.4+14.04.20131125-0ubuntu1
ProcVersionSignature: Ubuntu 3.12.0-4.10-generic 3.12.1
Uname: Linux 3.12.0-4-generic x86_64
ApportVersion: 2.12.7-0ubuntu1
Architecture: amd64
CheckboxSubmission: 1896b893828b4203b948b1eb6546be06
CheckboxSystem: d00f84de8a555815fa1c4660280da308
CurrentDesktop: Unity
Date: Wed Nov 27 13:44:38 2013
EcryptfsInUse: Yes
ExecutablePath: /usr/bin/autopilot
InstallationDate: Installed on 2012-03-16 (620 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64 (20120316)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/autopilot run unity.tests.test_panel.PanelCrossMonitorsTests.test_hovering_indicators_on_multiple_monitors
PythonArgs: ['/usr/bin/autopilot', 'run', 'unity.tests.test_panel.PanelCrossMonitorsTests.test_hovering_indicators_on_multiple_monitors']
SourcePackage: autopilot
Title: autopilot crashed with ImportError in _find_tests(): 'test_switcher' module incorrectly imported from '/usr/lib/python2.7/dist-packages/unity/tests'. Expected '/usr/lib/python2.7/dist-packages/unity/tests'. Is this module globally installed?
UpgradeStatus: Upgraded to trusty on 2013-10-23 (34 days ago)
UserGroups: adm autopilot cdrom dip lp lpadmin motion plugdev sambashare sudo

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :
information type: Private → Public
tags: removed: need-duplicate-check
Changed in autopilot (Ubuntu):
importance: Undecided → Medium
description: updated
description: updated
no longer affects: autopilot (Ubuntu)
summary: - autopilot crashed with ImportError in _find_tests(): 'test_switcher'
- module incorrectly imported from '/usr/lib/python2.7/dist-
- packages/unity/tests'. Expected '/usr/lib/python2.7/dist-
- packages/unity/tests'. Is this module globally installed?
+ Python programs crasheing with ImportError in _find_tests():
+ 'test_switcher' module incorrectly imported from 'xxx'. Expected 'xxx.
+ Is this module globally installed?
description: updated
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote : Re: Python programs crasheing with ImportError in _find_tests(): 'test_switcher' module incorrectly imported from 'xxx'. Expected 'xxx. Is this module globally installed?

Confirming that same problem with 2.7.6-1ubuntu1 and 2.7.6-1, but fixed if I downgrade to 2.7.5-8ubuntu4.

summary: - Python programs crasheing with ImportError in _find_tests():
+ Python program (autopilot) crashing with ImportError in _find_tests():
'test_switcher' module incorrectly imported from 'xxx'. Expected 'xxx.
Is this module globally installed?
Revision history for this message
Martin Pitt (pitti) wrote :

Looks like fallout from http://bugs.python.org/issue19352 which landed in https://launchpad.net/ubuntu/+source/python2.7/2.7.6-2.

Simple reproducer on a current trusty desktop with python-lazr.uri installed:

$ python -m unittest discover lazr

summary: - Python program (autopilot) crashing with ImportError in _find_tests():
- 'test_switcher' module incorrectly imported from 'xxx'. Expected 'xxx.
- Is this module globally installed?
+ unittest discover crashes with: module incorrectly imported from 'xxx'.
+ Expected 'xxx. Is this module globally installed?
Changed in python2.7 (Ubuntu):
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

Note that this is causing pretty much all autopilot tests to fail now, so severity critical.

Revision history for this message
Martin Pitt (pitti) wrote :

I confirmed that reverting the first hunk of http://bugs.python.org/file32304/unittest_loader_symlinks.patch inline on my system fixes this regression.

Changed in python2.7 (Ubuntu):
assignee: nobody → Barry Warsaw (barry)
Revision history for this message
Martin Pitt (pitti) wrote :

Turkey eating time in the US, I'll upload a reversion.

Changed in python2.7 (Ubuntu):
assignee: Barry Warsaw (barry) → Martin Pitt (pitti)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python2.7 - 2.7.6-2ubuntu1

---------------
python2.7 (2.7.6-2ubuntu1) trusty; urgency=low

  * Add debian/patches/revert-unittest-loader-symlinks19352.diff: Revert patch
    from http://bugs.python.org/issue19352 as it completely breaks unittest
    discovery on Debian/Ubuntu. (LP: #1255505)
 -- Martin Pitt <email address hidden> Thu, 28 Nov 2013 17:33:17 +0100

Changed in python2.7 (Ubuntu):
status: Confirmed → Fix Released
Changed in python:
status: Unknown → New
Changed in python:
status: New → Invalid
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.