This is an archive of the discontinued LLVM Phabricator instance.

[clang] [python] Move test_exception_specification_kind to correct subdir
ClosedPublic

Authored by mgorny on Sep 1 2017, 6:47 AM.

Details

Summary

The test_exception_specification_kind.py test has been committed
to the tests/ directory of clang Python bindings. As a result, it fails
since it attempts to load util.py module relatively from the current
directory:

======================================================================
ERROR: Failure: ImportError (No module named 'tests.util')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib64/python3.5/site-packages/nose/loader.py", line 419, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib64/python3.5/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib64/python3.5/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib64/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/usr/src/llvm/tools/clang/bindings/python/tests/test_exception_specification_kind.py", line 3, in <module>
    from .util import get_tu
ImportError: No module named 'tests.util'

After looking through the tree and the history of D34091, it seems that
the test was intended for the tests/cindex subdirectory where util.py
is indeed present. Move it there to fix the test.

Diff Detail

Event Timeline

mgorny created this revision.Sep 1 2017, 6:47 AM
ajbennieston accepted this revision.Sep 8 2017, 2:38 AM

Looks good to me.

This revision is now accepted and ready to land.Sep 8 2017, 2:38 AM
mgorny closed this revision.Sep 8 2017, 3:17 AM

It seems that somebody already moved the file in D37490.