From e4cbe5d3624ad9cc75a435b55eff492faec0daaf Mon Sep 17 00:00:00 2001 From: Clint Lawrence Date: Tue, 4 Jun 2024 21:11:42 +1000 Subject: [PATCH] Turn warning into errors and fix them --- src/fixate/core/common.py | 6 +++--- tox.ini | 12 ++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/fixate/core/common.py b/src/fixate/core/common.py index 1e31bdc2..aab698c3 100644 --- a/src/fixate/core/common.py +++ b/src/fixate/core/common.py @@ -84,7 +84,7 @@ def match_kwarg(search, keys): def sanitise_kwargs(kwargs, repl_kwargs): for kw in repl_kwargs: # Removes all non character symbols - new_kw = re.sub("[^\w]", "", repl_kwargs[kw]) + new_kw = re.sub(r"[^\w]", "", repl_kwargs[kw]) kwargs[new_kw] = kwargs.pop(kw) return kwargs @@ -128,7 +128,7 @@ def mode_builder(search_dict, repl_kwargs, *args, **kwargs): ret_string += mode_builder(search_dict[matches[0]], repl_kwargs, *args, **kwargs) # Remove the optional '[]' markers - ret_string = re.sub("[[\]]", "", ret_string) + ret_string = re.sub(r"[[\]]", "", ret_string) kwargs = sanitise_kwargs(kwargs, repl_kwargs) ret_string = ret_string.format(**kwargs) return ret_string @@ -182,7 +182,7 @@ def unit_scale(str_value, accepted_units=UNITS): ) ) # Match Decimal and Integer Values - p = re.compile("\d+(\.\d+)?") + p = re.compile(r"\d+(\.\d+)?") num_match = p.search(str_value) if num_match: num = float(num_match.group()) diff --git a/tox.ini b/tox.ini index 4634a858..677e1af8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,10 @@ [tox] -envlist = py37,py38,py39,py310,py311,black,mypy +envlist = py37,py38,py39,py310,py311,py312,black,mypy isolated_build = True [testenv] extras = test -commands = pytest --junitxml=junit/test-results.xml --cov=fixate --cov-report=xml --cov-report=html -m "not drivertest" - -# I've removed the pin on PyDAQmx but going to leave this here for the moment -# in case I need to put it back. -# <58.0.0 for PyDAQmx==1.3 which uses 2to3, which was deprecated in 58.0.0 -# Later versions of PyDAQmx fix this, but there are some breaking changes -# that we need to fix first. -# deps = -# setuptools < 58.0.0 +commands = pytest -W error --junitxml=junit/test-results.xml --cov=fixate --cov-report=xml --cov-report=html -m "not drivertest" [testenv:build] basepython = python3