def read(self, filepath):
"""Read the metadata values from a file path."""
- with open(filepath, 'r', encoding='ascii') as fp:
+ with open(filepath, 'r', encoding='utf-8') as fp:
self.read_file(fp)
def read_file(self, fileob):
def write(self, filepath):
"""Write the metadata fields to filepath."""
- with open(filepath, 'w') as fp:
+ with open(filepath, 'w', encoding='utf-8') as fp:
self.write_file(fp)
def write_file(self, fileobject):
def test_instantiation(self):
PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
- with open(PKG_INFO, 'r') as f:
+ with open(PKG_INFO, 'r', encoding='utf-8') as f:
contents = f.read()
fp = StringIO(contents)
def test_metadata_markers(self):
# see if we can be platform-aware
PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
- with open(PKG_INFO, 'r') as f:
+ with open(PKG_INFO, 'r', encoding='utf-8') as f:
content = f.read() % sys.platform
metadata = Metadata(platform_dependent=True)
def test_description(self):
PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
- with open(PKG_INFO, 'r') as f:
+ with open(PKG_INFO, 'r', encoding='utf-8') as f:
content = f.read() % sys.platform
metadata = Metadata()
metadata.read_file(StringIO(content))
def test_mapping_api(self):
PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
- with open(PKG_INFO, 'r') as f:
+ with open(PKG_INFO, 'r', encoding='utf-8') as f:
content = f.read() % sys.platform
metadata = Metadata(fileobj=StringIO(content))
self.assertIn('Version', metadata.keys())
PKG_INFO = os.path.join(os.path.dirname(__file__),
'SETUPTOOLS-PKG-INFO')
- with open(PKG_INFO, 'r') as f:
+ with open(PKG_INFO, 'r', encoding='utf-8') as f:
content = f.read()
metadata.read_file(StringIO(content))
self.assertEqual(metadata['Metadata-Version'], '1.0')
PKG_INFO = os.path.join(os.path.dirname(__file__),
'SETUPTOOLS-PKG-INFO2')
- with open(PKG_INFO, 'r') as f:
+ with open(PKG_INFO, 'r', encoding='utf-8') as f:
content = f.read()
metadata.read_file(StringIO(content))
self.assertEqual(metadata['Metadata-Version'], '1.1')