diff --git a/tests/spec_test.py b/tests/spec_test.py index a798321..82932f2 100644 --- a/tests/spec_test.py +++ b/tests/spec_test.py @@ -268,7 +268,7 @@ def test_migrate_config_file_does_not_exist_create(basic_spec): @patch('os.path.isfile', Mock(return_value=False)) def test_migrate_config_file_create_yaml(basic_spec): open_path = 'yapconf.open' - with patch('yapconf.yaml.dump') as dump_mock: + with patch('yapconf.yaml.safe_dump') as dump_mock: with patch(open_path, mock_open()) as mock_file: new_config = basic_spec.migrate_config_file( '/path/to/file', create=True, output_file_type='yaml') diff --git a/tests/yapconf_test.py b/tests/yapconf_test.py index 49b5533..1315024 100644 --- a/tests/yapconf_test.py +++ b/tests/yapconf_test.py @@ -20,7 +20,7 @@ def ascii_data(): @pytest.fixture def unicode_data(): return { - 'foo': 'bar', + u'foo': u'bar', 'db': {'name': 'db_name', 'port': 123}, 'items': [1, 2, 3], u'💩': u'🐍', diff --git a/yapconf/__init__.py b/yapconf/__init__.py index f31652e..19854a4 100644 --- a/yapconf/__init__.py +++ b/yapconf/__init__.py @@ -163,7 +163,7 @@ def _dump(data, stream, file_type, **kwargs): else: stream.write(six.u(dumped)) elif str(file_type).lower() == 'yaml': - yaml.dump(data, stream, **kwargs) + yaml.safe_dump(data, stream, **kwargs) else: raise NotImplementedError('Someone forgot to implement dump for file ' 'type: %s' % file_type)