test_python_import.py must test standard libraries too

Bug #1159671 reported by Jean-Baptiste Lallement
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Auto Upgrade Testing
Won't Fix
Undecided
Unassigned

Bug Description

Currently the test test_python_import.py only import modules from /usr/lib/PYTHONVER/dist-packages/ but doesn't test module from the standard library or other include paths.

So bugs such as the import below with python2.7 .7.4~rc1-2ubuntu1 evades our testing:
$ python -c "import webbrowser"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/webbrowser.py", line 505, in <module>
    register_X_browsers()
  File "/usr/lib/python2.7/webbrowser.py", line 489, in register_X_browsers
    register(browser, None, Chrome(browser))
NameError: global name 'Chrome' is not defined

The test should import all importable modules from sys.path

summary: - test_python_import.py should test standard libraries too
+ test_python_import.py must test standard libraries too
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

I am seeing this error when running my to-do manager "Nitro".

alan@deep-thought:~$ /opt/nitro/bin/nitrotasks
Traceback (most recent call last):
  File "/opt/nitro/bin/nitrotasks", line 43, in <module>
    import nitrotasks
  File "/opt/nitro/lib/python2.7/dist-packages/nitrotasks/__init__.py", line 24, in <module>
    from nitrotasks import NitrotasksWindow
  File "/opt/nitro/lib/python2.7/dist-packages/nitrotasks/NitrotasksWindow.py", line 20, in <module>
    import webbrowser, os, sys, re, pickle, urllib, urllib2, threading
  File "/usr/lib/python2.7/webbrowser.py", line 505, in <module>
    register_X_browsers()
  File "/usr/lib/python2.7/webbrowser.py", line 489, in register_X_browsers
    register(browser, None, Chrome(browser))
NameError: global name 'Chrome' is not defined

Revision history for this message
Mauro (jasmines) wrote :

same here with many apps, like griffith, software center, and more...

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Could you please subscribe to bug 1159636 instead. This is where this issue is tracked.
This report is for the testcase in auto-upgrade-tester that should have catch this bug before python2.7 has been uploaded to the distro.

Paul Larson (pwlars)
Changed in auto-upgrade-testing:
status: New → Confirmed
Revision history for this message
Paul Larson (pwlars) wrote :

One thing to note, I don't think that simply adding import tests that included webbrowser.py would have caught, since it would depend on running with chromium set to the default browser and running in a graphical environment. Still, I agree it would be useful to make the coverage of python import tests more inclusive.

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

With all our pythons now having autopkgtests which test the installed modules, is that obsolete now?

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

agreed, we are running python testsuite which should catch this type of issue. If it doesn't it is a bug in upstream testsuite.

Changed in auto-upgrade-testing:
status: Confirmed → Won't Fix
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.