From 801cbb94e88089ecc0f2547aae7ebfb1902524ef Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Fri, 22 Nov 2024 07:43:27 +0100 Subject: [PATCH] chore: Switch from pylint to ruff (#82) --- .pre-commit-config.yaml | 13 ++++--- aiida_test_cache/__init__.py | 1 - aiida_test_cache/_config.py | 5 ++- aiida_test_cache/archive_cache/__init__.py | 2 +- aiida_test_cache/archive_cache/_fixtures.py | 38 ++++++++++++++------- aiida_test_cache/archive_cache/_utils.py | 27 +++++++-------- aiida_test_cache/mock_code/__init__.py | 5 +-- aiida_test_cache/mock_code/_cli.py | 15 ++++---- aiida_test_cache/mock_code/_env_keys.py | 9 +++-- aiida_test_cache/mock_code/_fixtures.py | 31 ++++++++--------- aiida_test_cache/mock_code/_hasher.py | 8 ++--- docs/source/conf.py | 10 +++--- docs/source/developer_guide/index.rst | 2 +- pyproject.toml | 35 ++++++++++++++----- tests/archive_cache/test_archive_cache.py | 17 +++------ tests/conftest.py | 3 +- tests/mock_code/test_diff.py | 16 ++++----- tests/mock_code/test_ignore_paths.py | 5 +-- 18 files changed, 127 insertions(+), 115 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff1c368..d9c6b3c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,15 +8,14 @@ repos: args: ['-i'] additional_dependencies: [toml] -- repo: local +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.4 hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix, --show-fixes] - - id: pylint - name: pylint - entry: pylint - types: [file, python] - language: system - exclude: '^(docs/)|(examples/)' +- repo: local + hooks: - id: mypy name: mypy diff --git a/aiida_test_cache/__init__.py b/aiida_test_cache/__init__.py index f6d2fd1..62447cb 100644 --- a/aiida_test_cache/__init__.py +++ b/aiida_test_cache/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """A pytest plugin for testing AiiDA plugins.""" __version__ = '0.1.0.dev1' diff --git a/aiida_test_cache/_config.py b/aiida_test_cache/_config.py index 9a70ec9..c5e9dd3 100644 --- a/aiida_test_cache/_config.py +++ b/aiida_test_cache/_config.py @@ -1,15 +1,14 @@ -# -*- coding: utf-8 -*- """ Helpers for managing the ``.aiida-test-cache-config.yml`` configuration file. """ +import collections import pathlib import typing as ty -import collections from enum import Enum -from voluptuous import Schema import yaml +from voluptuous import Schema CONFIG_FILE_NAME = '.aiida-test-cache-config.yml' diff --git a/aiida_test_cache/archive_cache/__init__.py b/aiida_test_cache/archive_cache/__init__.py index b017cc9..d46b9a7 100644 --- a/aiida_test_cache/archive_cache/__init__.py +++ b/aiida_test_cache/archive_cache/__init__.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- """ Defines fixtures for automatically creating / loading an AiiDA DB export, to enable AiiDA - level caching. """ +# ruff: noqa: F403, F405 from ._fixtures import * diff --git a/aiida_test_cache/archive_cache/_fixtures.py b/aiida_test_cache/archive_cache/_fixtures.py index c8bb07a..992d788 100644 --- a/aiida_test_cache/archive_cache/_fixtures.py +++ b/aiida_test_cache/archive_cache/_fixtures.py @@ -1,27 +1,36 @@ -# -*- coding: utf-8 -*- """ Defines pytest fixtures for automatically enable caching in tests and create aiida archives if not existent. Meant to be useful for WorkChain tests. """ -# pylint: disable=unused-argument, protected-access, redefined-outer-name - import os import pathlib -from contextlib import contextmanager import shutil import typing as ty +from contextlib import contextmanager import pytest - from aiida import plugins from aiida.common.links import LinkType -from aiida.orm import Code, Dict, SinglefileData, List, FolderData, RemoteData, StructureData -from aiida.orm import CalcJobNode, QueryBuilder from aiida.manage.caching import enable_caching +from aiida.orm import ( + CalcJobNode, + Code, + Dict, + FolderData, + List, + QueryBuilder, + RemoteData, + SinglefileData, + StructureData, +) -from ._utils import monkeypatch_hash_objects, get_node_from_hash_objects_caller -from ._utils import load_node_archive, create_node_archive from .._config import Config +from ._utils import ( + create_node_archive, + get_node_from_hash_objects_caller, + load_node_archive, + monkeypatch_hash_objects, +) __all__ = ( "pytest_addoption", "absolute_archive_path", "enable_archive_cache", "liberal_hash", @@ -146,7 +155,9 @@ def _absolute_archive_path( @pytest.fixture(scope='function') def enable_archive_cache( - liberal_hash: None, archive_cache_forbid_migration: bool, archive_cache_overwrite: bool, + liberal_hash: None, # noqa: ARG001 + archive_cache_forbid_migration: bool, + archive_cache_overwrite: bool, absolute_archive_path: ty.Callable ) -> ty.Callable: """ @@ -225,11 +236,12 @@ def liberal_hash(monkeypatch: pytest.MonkeyPatch, testing_config: Config) -> Non #Load the corresponding entry points node_ignored_attributes = { - plugins.DataFactory(entry_point): tuple(set(ignored)) + ('version', ) + plugins.DataFactory(entry_point): (*tuple(set(ignored)), "version") for entry_point, ignored in hash_ignore_config.get('node_attributes', {}).items() } - calcjob_ignored_attributes = tuple(hash_ignore_config.get('calcjob_attributes', []) - ) + ('version', ) + calcjob_ignored_attributes = ( + *tuple(hash_ignore_config.get("calcjob_attributes", [])), "version" + ) calcjob_ignored_inputs = tuple(hash_ignore_config.get('calcjob_inputs', [])) def mock_objects_to_hash_code(self): diff --git a/aiida_test_cache/archive_cache/_utils.py b/aiida_test_cache/archive_cache/_utils.py index fc55367..1bd6df4 100644 --- a/aiida_test_cache/archive_cache/_utils.py +++ b/aiida_test_cache/archive_cache/_utils.py @@ -1,16 +1,15 @@ """ Defines helper functions for the archive_cache pytest fixtures """ -import typing as ty -from functools import partial +import os import pathlib import tempfile -import os +import typing as ty +from functools import partial import pytest - -from aiida.orm import ProcessNode, QueryBuilder, Node from aiida.cmdline.utils.echo import echo_warning +from aiida.orm import Node, ProcessNode, QueryBuilder __all__ = ('rehash_processes', 'monkeypatch_hash_objects') @@ -47,8 +46,6 @@ def monkeypatch_hash_objects( monkeypatched on the Nodes, i.e. the _CLS_NODE_CACHING attribute """ - #pylint: disable=too-few-public-methods,protected-access - try: monkeypatch.setattr(node_class, "_get_objects_to_hash", hash_objects_func) except AttributeError: @@ -75,15 +72,14 @@ def get_node_from_hash_objects_caller(caller: ty.Any) -> Node: try: #Case for AiiDA 2.0: The class holding the _get_objects_to_hash method #is the NodeCaching class not the actual node - return caller._node #type: ignore[no-any-return] #pylint: disable=protected-access + return caller._node #type: ignore[no-any-return] except AttributeError: return caller #type: ignore[no-any-return] #Cross-compatible importing function for import AiiDA archives in 1.X and 2.X try: - from aiida.tools.archive import create_archive - from aiida.tools.archive import import_archive + from aiida.tools.archive import create_archive, import_archive import_archive = partial(import_archive, merge_extras=('n', 'c', 'u'), import_new_extras=True) def import_with_migrate( @@ -96,9 +92,8 @@ def import_with_migrate( Import AiiDA Archive. If the version is incompatible try to migrate the archive if --archive-cache-forbid-migration option is not specified """ - #pylint: disable=import-outside-toplevel - from aiida.tools.archive import get_format from aiida.common.exceptions import IncompatibleStorageSchema + from aiida.tools.archive import get_format try: import_archive(archive_path, *args, **kwargs) @@ -131,10 +126,12 @@ def import_with_migrate( Import AiiDA Archive. If the version is incompatible try to migrate the archive if --archive-cache-forbid-migration option is not specified """ - #pylint: disable=import-outside-toplevel - from aiida.tools.importexport import EXPORT_VERSION, IncompatibleArchiveVersionError # these are only availbale after aiida >= 1.5.0, maybe rely on verdi import instead - from aiida.tools.importexport import detect_archive_type + from aiida.tools.importexport import ( + EXPORT_VERSION, + IncompatibleArchiveVersionError, + detect_archive_type, + ) from aiida.tools.importexport.archive.migrators import get_migrator # type: ignore[import-not-found] try: diff --git a/aiida_test_cache/mock_code/__init__.py b/aiida_test_cache/mock_code/__init__.py index b51858a..ee799d0 100644 --- a/aiida_test_cache/mock_code/__init__.py +++ b/aiida_test_cache/mock_code/__init__.py @@ -2,9 +2,10 @@ Defines fixtures for mocking AiiDA codes, with caching at the level of the executable. """ +# ruff: noqa: F405 -from ._hasher import InputHasher -from ._fixtures import * +from ._fixtures import * # noqa: F403 +from ._hasher import InputHasher # noqa: F401 # Note: This is necessary for the sphinx doc - otherwise it does not find aiida_test_cache.mock_code.mock_code_factory __all__ = ( diff --git a/aiida_test_cache/mock_code/_cli.py b/aiida_test_cache/mock_code/_cli.py index cf3c4c1..59b77b0 100644 --- a/aiida_test_cache/mock_code/_cli.py +++ b/aiida_test_cache/mock_code/_cli.py @@ -1,21 +1,20 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """ Implements the executable for running a mock AiiDA code. """ -from datetime import datetime +import fnmatch import os -import sys import shutil import subprocess +import sys import typing as ty -import fnmatch +from datetime import datetime from pathlib import Path from ._env_keys import MockVariables -def run() -> None: # pylint: disable=too-many-branches +def run() -> None: """ Run the mock AiiDA code. If the corresponding result exists, it is simply copied over to the current working directory. Otherwise, @@ -39,12 +38,12 @@ def _log(msg: str, error=False) -> None: try: hasher_cls = env.get_hasher() - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: _log(f"loading hasher: {exc}", error=True) try: hash_digest = hasher_cls(env, _log)(Path('.')) - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: _log(f"computing hash: {exc}", error=True) res_dir = env.data_dir / f"mock-{env.label}-{hash_digest}" @@ -107,7 +106,7 @@ def copy_files( # accessing its content, hence using os.walk. for dirpath, _, filenames in os.walk(src_dir): relative_dir = Path(dirpath).relative_to(src_dir) - dirs_to_check = list(relative_dir.parents) + [relative_dir] + dirs_to_check = [*list(relative_dir.parents), relative_dir] if relative_dir.parts and relative_dir.parts[0] == ('.aiida'): continue diff --git a/aiida_test_cache/mock_code/_env_keys.py b/aiida_test_cache/mock_code/_env_keys.py index 82375c0..1abc94c 100644 --- a/aiida_test_cache/mock_code/_env_keys.py +++ b/aiida_test_cache/mock_code/_env_keys.py @@ -1,19 +1,18 @@ -# -*- coding: utf-8 -*- """ Defines the environment variable names for the mock code execution. """ -from dataclasses import dataclass -from enum import Enum import inspect import os -from pathlib import Path import typing as ty +from dataclasses import dataclass +from enum import Enum +from pathlib import Path from ._hasher import InputHasher, load_hasher @dataclass -class MockVariables: # pylint: disable=too-many-instance-attributes +class MockVariables: """ A class containing variables defined for the mock code execution. """ diff --git a/aiida_test_cache/mock_code/_fixtures.py b/aiida_test_cache/mock_code/_fixtures.py index b6207de..1bbdf07 100644 --- a/aiida_test_cache/mock_code/_fixtures.py +++ b/aiida_test_cache/mock_code/_fixtures.py @@ -1,26 +1,24 @@ -# -*- coding: utf-8 -*- """ Defines a pytest fixture for creating mock AiiDA codes. """ -import uuid -import shutil +import collections +import os import pathlib +import shutil import typing as ty +import uuid import warnings -import collections -import os -from pkg_resources import parse_version import click import pytest - -from aiida.orm import Code from aiida import __version__ as aiida_version +from aiida.orm import Code +from pkg_resources import parse_version +from .._config import CONFIG_FILE_NAME, Config, ConfigActions from ._env_keys import MockVariables from ._hasher import InputHasher -from .._config import Config, CONFIG_FILE_NAME, ConfigActions __all__ = ( "pytest_addoption", @@ -90,7 +88,7 @@ def mock_disable_mpi(request): @pytest.fixture(scope='session') -def testing_config(testing_config_action): # pylint: disable=redefined-outer-name +def testing_config(testing_config_action): """Get content of .aiida-test-cache-config.yml testing_config_action : @@ -110,7 +108,7 @@ def testing_config(testing_config_action): # pylint: disable=redefined-outer-na def _forget_mpi_decorator(func): """Modify :py:meth:`aiida.orm.Code.get_prepend_cmdline_params` to discard MPI parameters.""" - def _get_prepend_cmdline_params(self, mpi_args=None, extra_mpirun_params=None): # pylint: disable=unused-argument + def _get_prepend_cmdline_params(self, mpi_args=None, extra_mpirun_params=None): # noqa: ARG001 return func(self) return _get_prepend_cmdline_params @@ -121,7 +119,7 @@ def mock_code_factory( aiida_localhost, testing_config, testing_config_action, mock_regenerate_test_data, mock_fail_on_missing, mock_disable_mpi, monkeypatch, request: pytest.FixtureRequest, tmp_path: pathlib.Path -): # pylint: disable=all +): """ Fixture to create a mock AiiDA Code. @@ -145,7 +143,7 @@ def _get_mock_code( _regenerate_test_data: bool = mock_regenerate_test_data, _fail_on_missing: bool = mock_fail_on_missing, _disable_mpi: bool = mock_disable_mpi, - ): # pylint: disable=too-many-arguments,too-many-branches,too-many-locals + ): """ Creates a mock AiiDA code. If the same inputs have been run previously, the results are copied over from the corresponding sub-directory of @@ -178,13 +176,14 @@ def _get_mock_code( If True, regenerate test data instead of reusing. .. deprecated:: 0.1.0 - Keyword `ingore_files` is deprecated and will be removed in `v1.0`. Use `ignore_paths` instead. + Keyword `ignore_files` is deprecated and will be removed in `v1.0`. Use `ignore_paths` instead. """ if ignore_files != ('_aiidasubmit.sh', ): warnings.warn( 'keyword `ignore_files` is deprecated and will be removed in `v1.0`. Use `ignore_paths` instead.', - DeprecationWarning - ) # pylint: disable=no-member + DeprecationWarning, + stacklevel=2 + ) # It's easy to forget the final comma and pass a string, e.g. `ignore_paths = ('_aiidasubmit.sh')` for arg in (ignore_paths, ignore_files): diff --git a/aiida_test_cache/mock_code/_hasher.py b/aiida_test_cache/mock_code/_hasher.py index ada74be..6084396 100644 --- a/aiida_test_cache/mock_code/_hasher.py +++ b/aiida_test_cache/mock_code/_hasher.py @@ -1,12 +1,12 @@ """Hashing of input files.""" import hashlib -from importlib.util import spec_from_file_location, module_from_spec import inspect -from pathlib import Path import typing as ty +from importlib.util import module_from_spec, spec_from_file_location +from pathlib import Path if ty.TYPE_CHECKING: - from ._env_keys import MockVariables # pylint: disable=unused-import + from ._env_keys import MockVariables class InputHasher: @@ -44,7 +44,7 @@ def __call__(self, cwd: Path) -> str: return md5sum.hexdigest() - def modify_content(self, path: Path, content: bytes) -> ty.Optional[bytes]: # pylint: disable=unused-argument + def modify_content(self, path: Path, content: bytes) -> ty.Optional[bytes]: # noqa: ARG002 """A sub-class hook to modify the contents of the file, before hashing. If None is returned, the file is ignored, when generating the hash. diff --git a/docs/source/conf.py b/docs/source/conf.py index 6ed32c8..667126f 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -9,12 +9,13 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import contextlib import os import sys import time -import contextlib import aiida_test_cache + # -- AiiDA-related setup -------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, @@ -28,7 +29,7 @@ pass else: with contextlib.suppress(ImportError): - import sphinx_rtd_theme + import sphinx_rtd_theme # noqa: F401 html_theme = 'sphinx_rtd_theme' # -- General configuration ------------------------------------------------ @@ -68,8 +69,7 @@ current_year = str(time.localtime().tm_year) copyright_year_string = current_year if current_year == copyright_first_year else f"{copyright_first_year}-{current_year}" -# pylint: disable=redefined-builtin -copyright = f'{copyright_year_string}, {copyright_owners}. All rights reserved' +copyright = f'{copyright_year_string}, {copyright_owners}. All rights reserved' # noqa: A001 # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -292,7 +292,7 @@ def run_apidoc(_): env = os.environ.copy() env["SPHINX_APIDOC_OPTIONS" ] = 'members,special-members,private-members,undoc-members,show-inheritance' - subprocess.check_call([cmd_path] + options, env=env) + subprocess.check_call([cmd_path, *options], env=env) def setup(app): diff --git a/docs/source/developer_guide/index.rst b/docs/source/developer_guide/index.rst index 64f73c0..d5182ca 100644 --- a/docs/source/developer_guide/index.rst +++ b/docs/source/developer_guide/index.rst @@ -34,7 +34,7 @@ Enable enable automatic checks of code sanity and coding style:: pre-commit install After this, the `yapf `_ formatter, -the `pylint `_ linter, and +the `ruff `_ linter, and the `mypy `_ static type checker will run at every commit. diff --git a/pyproject.toml b/pyproject.toml index 3e8cffc..0b4372d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,6 @@ tests = [ ] pre_commit = [ "pre-commit", - "pylint~=3.3.1", "mypy==1.13", "types-setuptools==65.7.0.3", "types-PyYAML", @@ -76,14 +75,6 @@ aiida-mock-code = "aiida_test_cache.mock_code._cli:run" aiida_mock_code = "aiida_test_cache.mock_code" aiida_archive_cache = "aiida_test_cache.archive_cache" -[tool.pylint.format] -max-line-length = 120 - -[tool.pylint.messages_control] -disable = [ - "duplicate-code", -] - [tool.pytest.ini_options] filterwarnings = [] @@ -93,6 +84,32 @@ coalesce_brackets = true dedent_closing_brackets = true column_limit = 100 +[tool.ruff] +line-length = 130 +show-fixes = true + +[tool.ruff.lint] +ignore = ["E501", "TRY003"] +select = [ + "A", # flake8-builtins + "ARG", # flake8-unused-arguments + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "E", # pycodestyle + "F", # pyflakes + "I", # isort + "N", # pep8-naming + "PLE", # pylint error rules + "PLW", # pylint warning rules + "PLC", # pylint convention rules + "RUF", # ruff-specific rules + "TRY", # Tryceratops + "UP" # pyupgrade +] + +[tool.ruff.lint.per-file-ignores] +"tests/archive_cache/test_archive_cache.py" = ["ARG001"] + [tool.mypy] show_error_codes = true # Strictness settings diff --git a/tests/archive_cache/test_archive_cache.py b/tests/archive_cache/test_archive_cache.py index 45239ea..93d9264 100644 --- a/tests/archive_cache/test_archive_cache.py +++ b/tests/archive_cache/test_archive_cache.py @@ -1,16 +1,10 @@ -# -*- coding: utf-8 -*- """ Test basic usage of the mock code on examples using aiida-diff. """ -# pylint: disable=unused-argument, protected-access, too-many-arguments, invalid-name - import os import pytest - -from aiida.engine import run_get_node -from aiida.engine import WorkChain -from aiida.engine import ToContext +from aiida.engine import ToContext, WorkChain, run_get_node from aiida.orm import Node from aiida.orm.querybuilder import QueryBuilder from aiida.plugins import CalculationFactory @@ -26,7 +20,6 @@ class DiffWorkChain(WorkChain): """ Very simple workchain which wraps a diff calculation for testing purposes """ - #pylint: disable=missing-function-docstring @classmethod def define(cls, spec): @@ -59,8 +52,8 @@ def check_diff_workchain_fixture(): < --- > Please report to the ministry of silly walks. -""" - EXPECTED_HASH = '96535a026a714a51855ff788c6646badb7e35a4fb483526bf90474a9eaaa0847' +""" # noqa: N806 + EXPECTED_HASH = '96535a026a714a51855ff788c6646badb7e35a4fb483526bf90474a9eaaa0847' # noqa: N806 def _check_diff_workchain(res, node, should_have_used_cache=True): @@ -153,7 +146,7 @@ def test_mock_hash_codes(mock_code_factory, clear_database, liberal_hash): def test_enable_archive_cache( archive_path, aiida_local_code_factory, generate_diff_inputs, enable_archive_cache, clear_database, check_diff_workchain -): # pylint: disable=too-many-positional-arguments +): """ Basic test of the enable_archive_cache fixture """ @@ -171,7 +164,7 @@ def test_enable_archive_cache( def test_enable_archive_cache_non_existent( aiida_local_code_factory, generate_diff_inputs, enable_archive_cache, clear_database, tmp_path_factory, check_diff_workchain -): # pylint: disable=too-many-positional-arguments +): """ Test of the enable_archive_cache fixture that creation of the archive and overwriting of the archive works correctly diff --git a/tests/conftest.py b/tests/conftest.py index 31d1bcf..3ceba4a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,7 @@ pytest_plugins = [ 'pytester', -] # pylint: disable=invalid-name +] @pytest.fixture @@ -15,7 +15,6 @@ def generate_diff_inputs(datadir): """ def _generate_diff_inputs(): - #pylint: disable=import-outside-toplevel from aiida.orm import SinglefileData from aiida.plugins import DataFactory diff --git a/tests/mock_code/test_diff.py b/tests/mock_code/test_diff.py index b6f1385..4e256df 100644 --- a/tests/mock_code/test_diff.py +++ b/tests/mock_code/test_diff.py @@ -1,20 +1,18 @@ -# -*- coding: utf-8 -*- """ Test basic usage of the mock code on examples using aiida-diff. """ -import shutil -import os import json +import os +import shutil import tempfile from pathlib import Path -from pkg_resources import parse_version import pytest - from aiida import __version__ as aiida_version from aiida.engine import run_get_node from aiida.plugins import CalculationFactory +from pkg_resources import parse_version CALC_ENTRY_POINT = 'diff' @@ -131,7 +129,7 @@ def test_broken_code_generate(mock_code_factory, testing_config): assert 'diff-broken' in testing_config.get('mock_code') -def test_regenerate_test_data(mock_code_factory, generate_diff_inputs, datadir): # pylint: disable=redefined-outer-name +def test_regenerate_test_data(mock_code_factory, generate_diff_inputs, datadir): """ Check that mock code regenerates test data if asked to do so. @@ -158,7 +156,7 @@ def test_regenerate_test_data(mock_code_factory, generate_diff_inputs, datadir): @pytest.mark.usefixtures('relative_code') -def test_regenerate_test_data_relative(mock_code_factory, generate_diff_inputs, datadir): # pylint: disable=redefined-outer-name +def test_regenerate_test_data_relative(mock_code_factory, generate_diff_inputs, datadir): """ Check that mock code regenerates test data if asked to do so for a executable specified with a relative path. @@ -185,7 +183,7 @@ def test_regenerate_test_data_relative(mock_code_factory, generate_diff_inputs, assert (datadir / 'file1.txt').is_file() -def test_regenerate_test_data_executable(mock_code_factory, generate_diff_inputs, datadir): # pylint: disable=redefined-outer-name +def test_regenerate_test_data_executable(mock_code_factory, generate_diff_inputs, datadir): """ Check that mock code regenerates test data if asked to do so for a executable specified is only specified via the executable name @@ -216,7 +214,7 @@ def test_regenerate_test_data_executable(mock_code_factory, generate_diff_inputs @pytest.mark.skipif( parse_version(aiida_version) < parse_version('2.1.0'), reason='requires AiiDA v2.1.0+' ) -def test_disable_mpi(mock_code_factory, generate_diff_inputs): # pylint: disable=unused-argument +def test_disable_mpi(mock_code_factory, generate_diff_inputs): """ Check that disabling MPI is respected. diff --git a/tests/mock_code/test_ignore_paths.py b/tests/mock_code/test_ignore_paths.py index eac4f14..a2d7964 100644 --- a/tests/mock_code/test_ignore_paths.py +++ b/tests/mock_code/test_ignore_paths.py @@ -3,6 +3,7 @@ """ import os from pathlib import Path + import pytest from aiida_test_cache.mock_code._cli import copy_files @@ -31,7 +32,7 @@ def run_directory(tmp_path_factory): yield tmp_path -def test_ignore_paths(run_directory, tmp_path_factory): # pylint: disable=redefined-outer-name +def test_ignore_paths(run_directory, tmp_path_factory): """Test that ignore_paths works as expected.""" storage_directory = tmp_path_factory.mktemp('storage') @@ -69,7 +70,7 @@ def test_ignore_paths(run_directory, tmp_path_factory): # pylint: disable=redef assert (storage_directory / 'my' / 'subfolder' / 'file3.txt').is_file() -def test_ignore_files(run_directory, tmp_path_factory): # pylint: disable=redefined-outer-name +def test_ignore_files(run_directory, tmp_path_factory): """Test that ignore_files works as expected.""" storage_directory = tmp_path_factory.mktemp('storage')