~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Lib/importlib/test/extension/test_path_hook.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from importlib import _bootstrap
 
2
from . import util
 
3
 
 
4
import collections
 
5
import imp
 
6
import sys
 
7
import unittest
 
8
 
 
9
 
 
10
class PathHookTests(unittest.TestCase):
 
11
 
 
12
    """Test the path hook for extension modules."""
 
13
    # XXX Should it only succeed for pre-existing directories?
 
14
    # XXX Should it only work for directories containing an extension module?
 
15
 
 
16
    def hook(self, entry):
 
17
        return _bootstrap._ExtensionFileFinder(entry)
 
18
 
 
19
    def test_success(self):
 
20
        # Path hook should handle a directory where a known extension module
 
21
        # exists.
 
22
        self.assert_(hasattr(self.hook(util.PATH), 'find_module'))
 
23
 
 
24
 
 
25
def test_main():
 
26
    from test.support import run_unittest
 
27
    run_unittest(PathHookTests)
 
28
 
 
29
 
 
30
if __name__ == '__main__':
 
31
    test_main()