Add encoding in more tests

This commit is contained in:
Zac Hatfield-Dodds
2023-06-20 04:55:40 -07:00
parent 7e510769b4
commit 661b938fca
27 changed files with 213 additions and 144 deletions

View File

@@ -265,9 +265,9 @@ def test_plugin_already_exists(pytester: Pytester) -> None:
def test_exclude(pytester: Pytester) -> None:
hellodir = pytester.mkdir("hello")
hellodir.joinpath("test_hello.py").write_text("x y syntaxerror")
hellodir.joinpath("test_hello.py").write_text("x y syntaxerror", encoding="utf-8")
hello2dir = pytester.mkdir("hello2")
hello2dir.joinpath("test_hello2.py").write_text("x y syntaxerror")
hello2dir.joinpath("test_hello2.py").write_text("x y syntaxerror", encoding="utf-8")
pytester.makepyfile(test_ok="def test_pass(): pass")
result = pytester.runpytest("--ignore=hello", "--ignore=hello2")
assert result.ret == 0
@@ -276,13 +276,13 @@ def test_exclude(pytester: Pytester) -> None:
def test_exclude_glob(pytester: Pytester) -> None:
hellodir = pytester.mkdir("hello")
hellodir.joinpath("test_hello.py").write_text("x y syntaxerror")
hellodir.joinpath("test_hello.py").write_text("x y syntaxerror", encoding="utf-8")
hello2dir = pytester.mkdir("hello2")
hello2dir.joinpath("test_hello2.py").write_text("x y syntaxerror")
hello2dir.joinpath("test_hello2.py").write_text("x y syntaxerror", encoding="utf-8")
hello3dir = pytester.mkdir("hallo3")
hello3dir.joinpath("test_hello3.py").write_text("x y syntaxerror")
hello3dir.joinpath("test_hello3.py").write_text("x y syntaxerror", encoding="utf-8")
subdir = pytester.mkdir("sub")
subdir.joinpath("test_hello4.py").write_text("x y syntaxerror")
subdir.joinpath("test_hello4.py").write_text("x y syntaxerror", encoding="utf-8")
pytester.makepyfile(test_ok="def test_pass(): pass")
result = pytester.runpytest("--ignore-glob=*h[ea]llo*")
assert result.ret == 0