Skip to content

Commit f081901

Browse files
Kevin KirscheKludex
andauthored
✅ Ensure that warnings are treated as errors (#94)
Co-authored-by: Marcelo Trylesinski <[email protected]>
1 parent 94e281c commit f081901

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

bump_pydantic/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def main(
8282
progress.advance(task)
8383

8484
# Visitor logic
85-
code = Path(filename).read_text()
85+
code = Path(filename).read_text(encoding="utf8")
8686
module = cst.parse_module(code)
8787
module_and_package = calculate_module_and_package(str(package), filename)
8888

@@ -109,7 +109,7 @@ def main(
109109

110110
codemods = gather_codemods(disabled=disable)
111111

112-
log_fp = log_file.open("a+")
112+
log_fp = log_file.open("a+", encoding="utf8")
113113
partial_run_codemods = functools.partial(run_codemods, codemods, metadata_manager, scratch, package, diff)
114114
with Progress(*Progress.get_default_columns(), transient=True) as progress:
115115
task = progress.add_task(description="Executing codemods...", total=len(files))

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ target-version = 'py38'
7878

7979
[tool.pytest.ini_options]
8080
xfail_strict = true
81+
filterwarnings = [
82+
# Turn warnings that aren't filtered into exceptions
83+
"error",
84+
"ignore::pytest.PytestUnraisableExceptionWarning"
85+
]
8186

8287
[tool.coverage.run]
8388
branch = true

0 commit comments

Comments
 (0)