def test_normcase_registration(self):
# create an empty working set for a clean-slate test.
cwd = utils.mkdtemp(self)
mock_ws = WorkingSet([])
dist_ = Distribution(cwd, project_name='pkg', version='1.0')
dist_.egg_info = cwd # just lazy
registry = ArtifactRegistry('calmjs.artifacts', _working_set=mock_ws)
# case sensitive test; have to patch the normcase at artifact
# module with the nt version
from ntpath import normcase as nt_normcase
utils.stub_item_attr_value(self, artifact, 'normcase', nt_normcase)
# using named case for case sensitivity test.
c1 = EntryPoint.parse('case.js = dummy_builder:builder1')
c1.dist = dist_
c2 = EntryPoint.parse('Case.js = dummy_builder:builder2')
c2.dist = dist_
# use the error one
ct = join(cwd, 'calmjs_artifacts', 'Case.js')
with pretty_logging(stream=mocks.StringIO()) as stream:
registry.register_entry_point(c1)
registry.register_entry_point(c2)
log = stream.getvalue()
self.assertIn(
"entry point 'Case.js = dummy_builder:builder2' from package "
"'pkg 1.0' will generate an artifact at '%s' but it was already "
"registered to entry point 'case.js = dummy_builder:builder1'; "
"conflicting entry point registration will be ignored." % ct,
log
)
self.assertIn(
"the file mapping error is caused by this platform's case-"
"insensitive filename", log
)
评论列表
文章目录