From f18045d2af2fdc19577c6c2689b2ccb60057d811 Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Fri, 14 Jul 2023 12:56:53 +0000 Subject: [PATCH 1/4] Ensure that warnings are treated as errors --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9836a1b..44af268 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,10 @@ target-version = 'py38' [tool.pytest.ini_options] xfail_strict = true +filterwarnings = [ + # Turn warnings that aren't filtered into exceptions + "error", +] [tool.coverage.run] branch = true From c77ed8cf34239505f7564cf1b8352b41c0a73779 Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Fri, 14 Jul 2023 13:11:02 +0000 Subject: [PATCH 2/4] fix: encoding errors --- bump_pydantic/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bump_pydantic/main.py b/bump_pydantic/main.py index 7f1c282..6d4d93b 100644 --- a/bump_pydantic/main.py +++ b/bump_pydantic/main.py @@ -109,7 +109,7 @@ def main( codemods = gather_codemods(disabled=disable) - log_fp = log_file.open("a+") + log_fp = log_file.open("a+", encoding="utf8") partial_run_codemods = functools.partial(run_codemods, codemods, metadata_manager, scratch, package, diff) with Progress(*Progress.get_default_columns(), transient=True) as progress: task = progress.add_task(description="Executing codemods...", total=len(files)) From 33d4d9eee140e57957aedf955cacdb1cb5a7779a Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Mon, 17 Jul 2023 13:54:42 +0200 Subject: [PATCH 3/4] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 44af268..27cfaea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,7 @@ xfail_strict = true filterwarnings = [ # Turn warnings that aren't filtered into exceptions "error", + "ignore::pytest.PytestUnraisableExceptionWarning" ] [tool.coverage.run] From d039a215703c0fb9af06081962a0e78c8c581e15 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Mon, 17 Jul 2023 18:59:32 +0200 Subject: [PATCH 4/4] add another encoding --- bump_pydantic/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bump_pydantic/main.py b/bump_pydantic/main.py index 6d4d93b..39a45ab 100644 --- a/bump_pydantic/main.py +++ b/bump_pydantic/main.py @@ -82,7 +82,7 @@ def main( progress.advance(task) # Visitor logic - code = Path(filename).read_text() + code = Path(filename).read_text(encoding="utf8") module = cst.parse_module(code) module_and_package = calculate_module_and_package(str(package), filename)