[New-bugs-announce] [issue7878] regrtest should check for changes in import machinery

Brett Cannon report at bugs.python.org
Sun Feb 7 22:56:18 CET 2010

New submission from Brett Cannon <brett at python.org>:

The saved_test_environment context manager should check that sys.path_hooks, sys.path_importer_cache, and __import__ have not changed.

The thing that is tricky, though, is that sys.path_importer_cache is legitimately mutated by other tests simply because valid imports put in new values. The most conservative check, then, is to validate that pre-existing keys do not change their values. A more liberal check is to whitelist finders and validate that no key have a value that is not on the whitelist.

And for __import__, assigning against __builtins__.__import__ should be enough to also catch builtins.__import__.

assignee: brett.cannon
components: Tests
keywords: easy
messages: 99024
nosy: brett.cannon
priority: low
severity: normal
stage: needs patch
status: open
title: regrtest should check for changes in import machinery
type: feature request
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list