def test_read_pyvenv_cfg(tmpdir): pyvenv_cfg = tmpdir.join('pyvenv.cfg') pyvenv_cfg.write( '# I am a comment\n' '\n' 'foo = bar\n' 'version-info=123\n', ) expected = {'foo': 'bar', 'version-info': '123'} assert python._read_pyvenv_cfg(pyvenv_cfg) == expected
def test_read_pyvenv_cfg_non_utf8(tmpdir): pyvenv_cfg = tmpdir.join('pyvenv_cfg') pyvenv_cfg.write_binary('hello = hello john.š\n'.encode()) expected = {'hello': 'hello john.š'} assert python._read_pyvenv_cfg(pyvenv_cfg) == expected