[issue14035] behavior of test.support.import_fresh_module

Florent Xicluna report at bugs.python.org
Thu Feb 16 22:36:07 CET 2012

New submission from Florent Xicluna <florent.xicluna at gmail.com>:

While writing tests xml.etree, I hit a strange behaviour of import_fresh_module.

How to reproduce:

- dummy/__init__.py
- dummy/foo.py
- dummy/bar.py
- test_fresh_import.py

# 'dummy/foo.py'
from dummy.bar import func

# 'dummy/bar.py'
fortytwo = 42
def func():
    assert fortytwo == 42

# 'test_fresh_import.py'
(see attachment)

# Output:
~ $ ./python.exe test_fresh_import.py 
OK dummy.foo
OK dummy.bar
OK dummy.bar
OK dummy.foo
Traceback (most recent call last):
  File "test_fresh_import.py", line 24, in <module>
  File "test_fresh_import.py", line 5, in test_fresh
    rv = module.func()
  File "./dummy/bar.py", line 6, in func
    assert fortytwo == 42

components: Tests
files: test_fresh_import.py
messages: 153503
nosy: eli.bendersky, flox, ncoghlan
priority: normal
severity: normal
status: open
title: behavior of test.support.import_fresh_module
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file24534/test_fresh_import.py

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list