Message194778
I quickly ran the tests with each of the above edits to see what bits of the test suite would break.
With option 1 (edits to PathFinder only):
``1 test failed:
test_importlib``
With option 2 (edits to FileFinder only):
``3 tests failed:
test_import test_importlib test_support``
With option 3 (edits to PathFinder and FileFinder):
``3 tests failed:
test_import test_importlib test_support``
So using the cwd as a key in sys.path_importer_cache seems to break fewer tests than using '' as a key does. Perhaps that counts for something.
In test_importlib, the only test to fail was `test_path_importer_cache_empty_string()`, for rather obvious reasons.
I haven't spent much time looking at failing tests in test_import and test_support yet, though.
In regard to sys.path_importer_cache behavior -- at first glance, I'd lean toward either:
1) Creating a new entry in sys.path_importer_cache after changing directories and importing a new module (as is the case in option 1).
Key: os.getcwd() => Value: FileFinder(os.getcwd())
2) Keeping the current behavior in sys.path_importer_cache and somehow changing the __file__ attribute a bit further down the line (perhaps in `FileFinder._init_file_attr()` or `FileLoader.get_filename()`).
Key: '.' => Value: FileFinder('.')
or with a minor tweak for consistency with sys.path:
Key: '' => Value: FileFinder('.')
Have you given the issue any more thought, Brett? |
|
Date |
User |
Action |
Args |
2013-08-09 23:59:56 | madison.may | set | recipients:
+ madison.may, brett.cannon, ronaldoussoren, ncoghlan, Arfrever |
2013-08-09 23:59:55 | madison.may | set | messageid: <1376092795.97.0.29503460495.issue18416@psf.upfronthosting.co.za> |
2013-08-09 23:59:55 | madison.may | link | issue18416 messages |
2013-08-09 23:59:55 | madison.may | create | |
|