[issue14038] Packaging test support code raises exception

Vinay Sajip report at bugs.python.org
Fri Feb 17 00:48:55 CET 2012


New submission from Vinay Sajip <vinay_sajip at yahoo.co.uk>:

test_packaging has started failing in the pythonv branch:

======================================================================
ERROR: test_old_record_extensions (packaging.tests.test_command_install_dist.InstallTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/packaging/tests/test_command_install_dist.py", line 214, in test_old_record_extensions
    support.copy_xxmodule_c(project_dir)
  File "/usr/local/lib/python3.3/packaging/tests/support.py", line 334, in copy_xxmodule_c
    filename = _get_xxmodule_path()
  File "/usr/local/lib/python3.3/packaging/tests/support.py", line 346, in _get_xxmodule_path
    if os.path.exists(path):
UnboundLocalError: local variable 'path' referenced before assignment

======================================================================
ERROR: test_build_ext (packaging.tests.test_command_build_ext.BuildExtTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/packaging/tests/test_command_build_ext.py", line 30, in test_build_ext
    support.copy_xxmodule_c(self.tmp_dir)
  File "/usr/local/lib/python3.3/packaging/tests/support.py", line 334, in copy_xxmodule_c
    filename = _get_xxmodule_path()
  File "/usr/local/lib/python3.3/packaging/tests/support.py", line 346, in _get_xxmodule_path
    if os.path.exists(path):
UnboundLocalError: local variable 'path' referenced before assignment

Upon investigation, the code for _get_xxmodule_path is this:

def _get_xxmodule_path():
    if sysconfig.is_python_build():
        srcdir = sysconfig.get_config_var('projectbase')
        path = os.path.join(os.getcwd(), srcdir, 'Modules', 'xxmodule.c')
    else:
        os.path.join(os.path.dirname(__file__), 'xxmodule.c')
    if os.path.exists(path):
        return path

It looks as if the else: path should have a "path = " ... with that change, the test_packaging failures go away.

----------
assignee: tarek
components: Distutils2, Library (Lib)
messages: 153515
nosy: alexis, eric.araujo, tarek, vinay.sajip
priority: normal
severity: normal
status: open
title: Packaging test support code raises exception
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14038>
_______________________________________


More information about the Python-bugs-list mailing list