From 36359e23449482c03ebfdc2c1055dddcd2fff7ab Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 20 Nov 2024 08:35:59 -0500 Subject: [PATCH] tests: replaced module imports to the top (#4656) --- .flake8 | 3 +-- python/grass/pygrass/tests/benchmark.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 207535e2ea2..1e8a6f880d7 100644 --- a/.flake8 +++ b/.flake8 @@ -63,11 +63,10 @@ per-file-ignores = python/grass/temporal/temporal_granularity.py: E722 # Current benchmarks/tests are changing sys.path before import. # Possibly, a different approach should be taken there anyway. - python/grass/pygrass/tests/benchmark.py: E402, F821 + python/grass/pygrass/tests/benchmark.py: F821 # Configuration file for Sphinx: # Ignoring import/code mix and line length. # Files not managed by Black - python/grass/imaging/images2gif.py: E226 # Unused imports in init files # F403 star import used; unable to detect undefined names python/grass/temporal/__init__.py: F401, F403 diff --git a/python/grass/pygrass/tests/benchmark.py b/python/grass/pygrass/tests/benchmark.py index fa7f0c01a65..b6c5e98c26d 100644 --- a/python/grass/pygrass/tests/benchmark.py +++ b/python/grass/pygrass/tests/benchmark.py @@ -15,14 +15,19 @@ from jinja2 import Template from pathlib import Path + sys.path.append(str(Path.cwd())) sys.path.append("%s/.." % (str(Path.cwd()))) + +# flake8: noqa: E402 import grass.lib.gis as libgis import grass.lib.raster as libraster import grass.script as gs import ctypes +# flake8: qa + def test__RasterSegment_value_access__if(): test_a = pygrass.RasterSegment(name="test_a")