From 9a26030bd51bd01739701ef1fc43d7060b22a05c Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Thu, 11 Oct 2018 17:34:46 +0200 Subject: [PATCH] Change the config test to remove `NamedTemporaryFile` --- tests/test_config.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 7ee291d1..78596004 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -89,13 +89,12 @@ def test_load_from_missing_envvar(app): def test_load_config_from_file_invalid_syntax(app): - config = b"VALUE = some value" - with NamedTemporaryFile() as config_file: - config_file.write(config) - config_file.seek(0) + config = "VALUE = some value" + with temp_path() as config_path: + config_path.write_text(config) with pytest.raises(PyFileError): - app.config.from_pyfile(config_file.name) + app.config.from_pyfile(config_path) def test_overwrite_exisiting_config(app):