Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
importlib.test.source.test_case_sensitivity.CaseSensitivityTest Class Reference
Collaboration diagram for importlib.test.source.test_case_sensitivity.CaseSensitivityTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def find
def sensitivity_test
def test_sensitive
def test_insensitive

Static Public Attributes

string name = 'MoDuLe'

Detailed Description

PEP 235 dictates that on case-preserving, case-insensitive file systems
that imports are case-sensitive unless the PYTHONCASEOK environment
variable is set.

Definition at line 12 of file test_case_sensitivity.py.


Member Function Documentation

Definition at line 21 of file test_case_sensitivity.py.

00021 
00022     def find(self, path):
00023         finder = _bootstrap._FileFinder(path,
00024                                         _bootstrap._SourceFinderDetails(),
00025                                         _bootstrap._SourcelessFinderDetails())
00026         return finder.find_module(self.name)

Here is the caller graph for this function:

Look for a module with matching and non-matching sensitivity.

Definition at line 27 of file test_case_sensitivity.py.

00027 
00028     def sensitivity_test(self):
00029         """Look for a module with matching and non-matching sensitivity."""
00030         sensitive_pkg = 'sensitive.{0}'.format(self.name)
00031         insensitive_pkg = 'insensitive.{0}'.format(self.name.lower())
00032         context = source_util.create_modules(insensitive_pkg, sensitive_pkg)
00033         with context as mapping:
00034             sensitive_path = os.path.join(mapping['.root'], 'sensitive')
00035             insensitive_path = os.path.join(mapping['.root'], 'insensitive')
00036             return self.find(sensitive_path), self.find(insensitive_path)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 45 of file test_case_sensitivity.py.

00045 
00046     def test_insensitive(self):
00047         with test_support.EnvironmentVarGuard() as env:
00048             env.set('PYTHONCASEOK', '1')
00049             sensitive, insensitive = self.sensitivity_test()
00050             self.assertTrue(hasattr(sensitive, 'load_module'))
00051             self.assertIn(self.name, sensitive.get_filename(self.name))
00052             self.assertTrue(hasattr(insensitive, 'load_module'))
00053             self.assertIn(self.name, insensitive.get_filename(self.name))
00054 

Here is the call graph for this function:

Definition at line 37 of file test_case_sensitivity.py.

00037 
00038     def test_sensitive(self):
00039         with test_support.EnvironmentVarGuard() as env:
00040             env.unset('PYTHONCASEOK')
00041             sensitive, insensitive = self.sensitivity_test()
00042             self.assertTrue(hasattr(sensitive, 'load_module'))
00043             self.assertIn(self.name, sensitive.get_filename(self.name))
00044             self.assertIsNone(insensitive)

Here is the call graph for this function:


Member Data Documentation

Definition at line 18 of file test_case_sensitivity.py.


The documentation for this class was generated from the following file: