use tmp_path instead of tmpdir
This commit is contained in:
parent
1d7281fe07
commit
0a00e1b608
4 changed files with 59 additions and 64 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import json
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -242,17 +241,10 @@ def test_get_namespace():
|
|||
|
||||
|
||||
@pytest.mark.parametrize("encoding", ["utf-8", "iso-8859-15", "latin-1"])
|
||||
def test_from_pyfile_weird_encoding(tmpdir, encoding):
|
||||
f = tmpdir.join("my_config.py")
|
||||
f.write_binary(
|
||||
textwrap.dedent(
|
||||
f"""
|
||||
# -*- coding: {encoding} -*-
|
||||
TEST_VALUE = "föö"
|
||||
"""
|
||||
).encode(encoding)
|
||||
)
|
||||
def test_from_pyfile_weird_encoding(tmp_path, encoding):
|
||||
f = tmp_path / "my_config.py"
|
||||
f.write_text(f'# -*- coding: {encoding} -*-\nTEST_VALUE = "föö"\n', encoding)
|
||||
app = flask.Flask(__name__)
|
||||
app.config.from_pyfile(str(f))
|
||||
app.config.from_pyfile(os.fspath(f))
|
||||
value = app.config["TEST_VALUE"]
|
||||
assert value == "föö"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue