From dcf2dc692e9644dfba0a66c1396bb8738c3238fb Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Tue, 28 May 2024 08:21:41 +0200 Subject: [PATCH] Attempt at supporting Python 3.12 --- environment.yml | 8 ++++++-- esmvalcore/_task.py | 2 +- setup.py | 3 ++- tests/unit/main/test_main.py | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/environment.yml b/environment.yml index 4cfed229c3..0f7c13545a 100644 --- a/environment.yml +++ b/environment.yml @@ -36,7 +36,7 @@ dependencies: - psutil - py-cordex - pybtex - - python >=3.9,<3.12 + - python >=3.9 - python-stratify >=0.3 - pyyaml - requests @@ -50,7 +50,6 @@ dependencies: - sphinx >=6.1.3 - pydata-sphinx-theme # Python packages needed for testing - - flake8 - mypy >=0.990 - pytest >=3.9,!=6.0.0rc1,!=6.0.0 - pytest-cov >=2.10.1 @@ -58,6 +57,7 @@ dependencies: - pytest-html !=2.1.0 - pytest-metadata >=1.5.1 - pytest-mock + - pytest-mypy - pytest-xdist # Not on conda-forge - ESMValTool_sample_data==0.0.3 # Still for testing, MyPy library stubs @@ -69,6 +69,10 @@ dependencies: - isort - pre-commit - prospector >=1.9.0 + - pyroma # Not on conda forge - vprof - yamllint - yapf + - pip: + - flake8>=7 + - ESMValTool_sample_data diff --git a/esmvalcore/_task.py b/esmvalcore/_task.py index 04200371cd..2b785bc8d6 100644 --- a/esmvalcore/_task.py +++ b/esmvalcore/_task.py @@ -566,7 +566,7 @@ def _run(self, input_files): returncode = None - with resource_usage_logger(process.pid, self.resource_log),\ + with resource_usage_logger(process.pid, self.resource_log), \ open(self.log, 'ab') as log: last_line = [''] while returncode is None: diff --git a/setup.py b/setup.py index 0a7bf9ab97..95f426a282 100755 --- a/setup.py +++ b/setup.py @@ -94,8 +94,9 @@ 'codespell', 'docformatter', 'isort', + 'flake8>=7', 'pre-commit', - 'prospector[with_pyroma]>=1.9.0', + # 'prospector[with_pyroma]>=1.9.0', 'vprof', 'yamllint', 'yapf', diff --git a/tests/unit/main/test_main.py b/tests/unit/main/test_main.py index 155c8025d1..546115156a 100644 --- a/tests/unit/main/test_main.py +++ b/tests/unit/main/test_main.py @@ -24,7 +24,7 @@ def test_run_recipe_error(mocker, caplog): print(caplog.text) # Check that the exit status is 1 - assert exit_.called_once_with(1) + exit_.assert_called_once_with(1) # Check that only the RecipeError is logged above DEBUG level errors = [r for r in caplog.records if r.levelname != 'DEBUG']