This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: regrtest should not just skip imports that fail
Type: behavior Stage:
Components: Tests Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jeff.balogh, nnorwitz, r.david.murray
Priority: high Keywords: patch

Created on 2008-03-18 21:22 by nnorwitz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
optional_import.diff jeff.balogh, 2008-03-19 03:04 diff against r61589
sunaudiodev-refactor.diff jeff.balogh, 2008-03-19 03:28 diff against r61589
winreg-refactor.diff jeff.balogh, 2008-03-19 03:59 diff against r61589
Messages (7)
msg63992 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2008-03-18 21:22
Guido mentioned this in python-3000-checkins.  I agree the problem
should be fixed.

"""
I think the automatic skip on ImportError is harmful.

We should add a helper function to test_support so that you can write

foobar = test_support.import_optional('foobar')

and it will skip the test if foobar cannot be imported; all other
failing imports should cause the test to *fail*.

This should be an easy two-part task.
"""
msg64028 - (view) Author: Jeff Balogh (jeff.balogh) * Date: 2008-03-19 03:04
Attaching a patch that implements optional_import().

The only arg included from __import__ is fromfile, as it's the only one 
I needed to fix up the stdlib.
msg64029 - (view) Author: Jeff Balogh (jeff.balogh) * Date: 2008-03-19 03:26
Attaching a patch that removes ``from _winreg import *`` in 
test_winreg.py, which will allow usage of optional_import.
msg64030 - (view) Author: Jeff Balogh (jeff.balogh) * Date: 2008-03-19 03:28
Attaching a patch that refactors the test_sunaudiodev.py imports.
msg64032 - (view) Author: Jeff Balogh (jeff.balogh) * Date: 2008-03-19 03:59
The previous winreg refactor patch didn't catch all the changes; 
attaching a new patch that fixes everything, with help from Trent 
Nelson.
msg64035 - (view) Author: Jeff Balogh (jeff.balogh) * Date: 2008-03-19 04:30
Attaching a patch, based on the previous patches, that fixes the stdlib 
to use optional_import where ImportError was raised.

These need testing on various platforms to make sure all the 
ImportErrors are caught.  I'm on x86 Linux.
msg84958 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-04-01 02:06
Fixed as of r70930 on trunk and shortly thereafter on the py3k branch.

I did this at the pycon sprint, and unfortunately I only discovered this
issue and your patches after I was done.  So thank you for your work and
I'm sorry it didn't actually get used (it would have allowed me to get
done faster if I'd known about it).  The solution implemented is very
similar to yours, though different in a few details.
History
Date User Action Args
2022-04-11 14:56:32adminsetgithub: 46661
2009-04-01 02:06:29r.david.murraysetstatus: open -> closed
versions: + Python 3.1, Python 2.7, - Python 2.6
nosy: + r.david.murray

messages: + msg84958

resolution: fixed
2009-04-01 01:57:24r.david.murraysetfiles: - issue2409.diff
2008-04-29 21:09:51benjamin.petersonsettype: behavior
2008-03-19 04:30:39jeff.baloghsetfiles: + issue2409.diff
messages: + msg64035
2008-03-19 03:59:56jeff.baloghsetfiles: + winreg-refactor.diff
messages: + msg64032
2008-03-19 03:57:08loewissetfiles: - winreg-refactor.diff
2008-03-19 03:28:45jeff.baloghsetfiles: + sunaudiodev-refactor.diff
messages: + msg64030
2008-03-19 03:26:51jeff.baloghsetfiles: + winreg-refactor.diff
messages: + msg64029
2008-03-19 03:04:17jeff.baloghsetfiles: + optional_import.diff
keywords: + patch
messages: + msg64028
nosy: + jeff.balogh
2008-03-18 21:22:27nnorwitzcreate