From 423b4ec0f09bc7325fe95538c3088db619ac5cef Mon Sep 17 00:00:00 2001 From: Jan-Lukas Wynen Date: Mon, 19 Aug 2024 10:49:51 +0200 Subject: [PATCH] Update ruff --- .pre-commit-config.yaml | 2 +- src/scitacean/testing/backend/fixtures.py | 6 +++--- src/scitacean/testing/sftp/fixtures.py | 2 +- tests/client/attachment_client_test.py | 6 +++--- tests/client/datablock_client_test.py | 6 +++--- tests/client/dataset_client_test.py | 4 ++-- tests/client/sample_client_test.py | 8 ++++---- tests/dataset_test.py | 4 ++-- tests/download_test.py | 4 ++-- tests/file_test.py | 2 +- tests/transfer/sftp_test.py | 4 ++-- tests/upload_test.py | 8 ++++---- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e7153033..84a76a6d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: args: ["--drop-empty-cells", "--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.7 + rev: v0.6.1 hooks: - id: ruff-format types_or: [ python, pyi ] diff --git a/src/scitacean/testing/backend/fixtures.py b/src/scitacean/testing/backend/fixtures.py index 79875ec9..eb5334f0 100644 --- a/src/scitacean/testing/backend/fixtures.py +++ b/src/scitacean/testing/backend/fixtures.py @@ -35,7 +35,7 @@ def scicat_access() -> SciCatAccess: return local_access("user1") -@pytest.fixture() +@pytest.fixture def fake_client(scicat_access: SciCatAccess) -> FakeClient: """Fixture that returns a fake client. @@ -72,7 +72,7 @@ def fake_client(scicat_access: SciCatAccess) -> FakeClient: return client -@pytest.fixture() +@pytest.fixture def real_client(scicat_access: SciCatAccess, scicat_backend: bool) -> Client | None: """Fixture that returns a real client if backend tests are enabled. @@ -110,7 +110,7 @@ def client(request, scicat_backend) -> Client | FakeClient: return request.getfixturevalue("real_client") # type: ignore[no-any-return] -@pytest.fixture() +@pytest.fixture def require_scicat_backend(request, scicat_backend) -> None: # noqa: PT004 """Fixture to declare that a test needs a local scicat backend. diff --git a/src/scitacean/testing/sftp/fixtures.py b/src/scitacean/testing/sftp/fixtures.py index 6f865f61..4d5fd22b 100644 --- a/src/scitacean/testing/sftp/fixtures.py +++ b/src/scitacean/testing/sftp/fixtures.py @@ -75,7 +75,7 @@ def sftp_data_dir(sftp_base_dir: Path | None) -> Path | None: return sftp_base_dir / "data" -@pytest.fixture() +@pytest.fixture def require_sftp_fileserver(request, sftp_fileserver) -> None: # noqa: PT004 """Fixture to declare that a test needs a local SFTP server. diff --git a/tests/client/attachment_client_test.py b/tests/client/attachment_client_test.py index 3c52b747..c627c0d1 100644 --- a/tests/client/attachment_client_test.py +++ b/tests/client/attachment_client_test.py @@ -21,12 +21,12 @@ ) -@pytest.fixture() +@pytest.fixture def scicat_client(client: Client) -> ScicatClient: return client.scicat -@pytest.fixture() +@pytest.fixture def derived_dataset(scicat_access): return UploadDerivedDataset( contactEmail="black.foess@dom.koelle", @@ -43,7 +43,7 @@ def derived_dataset(scicat_access): ) -@pytest.fixture() +@pytest.fixture def attachment(scicat_access): return UploadAttachment( caption="An attachment", diff --git a/tests/client/datablock_client_test.py b/tests/client/datablock_client_test.py index c0c95d23..27f5f07f 100644 --- a/tests/client/datablock_client_test.py +++ b/tests/client/datablock_client_test.py @@ -18,12 +18,12 @@ ) -@pytest.fixture() +@pytest.fixture def scicat_client(client: Client) -> ScicatClient: return client.scicat -@pytest.fixture() +@pytest.fixture def derived_dataset(scicat_access): return UploadDerivedDataset( contactEmail="black.foess@dom.koelle", @@ -40,7 +40,7 @@ def derived_dataset(scicat_access): ) -@pytest.fixture() +@pytest.fixture def orig_datablock(scicat_access): # NOTE the placeholder! return UploadOrigDatablock( diff --git a/tests/client/dataset_client_test.py b/tests/client/dataset_client_test.py index a41499d9..73f2ab21 100644 --- a/tests/client/dataset_client_test.py +++ b/tests/client/dataset_client_test.py @@ -18,12 +18,12 @@ ) -@pytest.fixture() +@pytest.fixture def scicat_client(client: Client) -> ScicatClient: return client.scicat -@pytest.fixture() +@pytest.fixture def derived_dataset(scicat_access): return UploadDerivedDataset( contactEmail="black.foess@dom.koelle", diff --git a/tests/client/sample_client_test.py b/tests/client/sample_client_test.py index fabc5404..f5762fbc 100644 --- a/tests/client/sample_client_test.py +++ b/tests/client/sample_client_test.py @@ -15,7 +15,7 @@ # Creating samples requires at least ingestor permissions. -@pytest.fixture() +@pytest.fixture def ingestor_access( scicat_access: backend_config.SciCatAccess, ) -> backend_config.SciCatAccess: @@ -25,7 +25,7 @@ def ingestor_access( ) -@pytest.fixture() +@pytest.fixture def real_client( request: pytest.FixtureRequest, ingestor_access: backend_config.SciCatAccess, @@ -38,12 +38,12 @@ def real_client( ) -@pytest.fixture() +@pytest.fixture def scicat_client(client: Client) -> ScicatClient: return client.scicat -@pytest.fixture() +@pytest.fixture def sample(ingestor_access): scicat_access = ingestor_access return Sample( diff --git a/tests/dataset_test.py b/tests/dataset_test.py index 534dd837..bb649419 100644 --- a/tests/dataset_test.py +++ b/tests/dataset_test.py @@ -17,7 +17,7 @@ from .common.files import make_file -@pytest.fixture() +@pytest.fixture def raw_download_model(): return model.DownloadDataset( contactEmail="p.stibbons@uu.am", @@ -86,7 +86,7 @@ def raw_download_model(): ) -@pytest.fixture() +@pytest.fixture def derived_download_model(): return model.DownloadDataset( contactEmail="p.stibbons@uu.am", diff --git a/tests/download_test.py b/tests/download_test.py index 64c70cd9..b25760e5 100644 --- a/tests/download_test.py +++ b/tests/download_test.py @@ -22,7 +22,7 @@ def _checksum(data: bytes) -> str: return checksum.hexdigest() -@pytest.fixture() +@pytest.fixture def data_files(): contents = { "file1.dat": b"contents-of-file1", @@ -41,7 +41,7 @@ def data_files(): return files, contents -@pytest.fixture() +@pytest.fixture def dataset_and_files(data_files): model = DownloadDataset( contactEmail="p.stibbons@uu.am", diff --git a/tests/file_test.py b/tests/file_test.py index 718e2ea8..11e84217 100644 --- a/tests/file_test.py +++ b/tests/file_test.py @@ -16,7 +16,7 @@ from .common.files import make_file -@pytest.fixture() +@pytest.fixture def fake_file(fs): return make_file(fs, path=Path("local", "dir", "events.nxs")) diff --git a/tests/transfer/sftp_test.py b/tests/transfer/sftp_test.py index f255747d..8c461798 100644 --- a/tests/transfer/sftp_test.py +++ b/tests/transfer/sftp_test.py @@ -295,7 +295,7 @@ def open_sftp_client(self) -> paramiko.SFTPClient: return CorruptingSFTP.from_transport(self) -@pytest.fixture() +@pytest.fixture def sftp_corrupting_connect(sftp_access, sftp_connection_config): def connect(host: str, port: int) -> paramiko.SFTPClient: client = paramiko.SSHClient() @@ -324,7 +324,7 @@ def open_sftp_client(self) -> paramiko.SFTPClient: return RaisingSFTP.from_transport(self) -@pytest.fixture() +@pytest.fixture def sftp_raising_connect(sftp_access): def connect(host: str, port: int) -> paramiko.SFTPClient: client = paramiko.SSHClient() diff --git a/tests/upload_test.py b/tests/upload_test.py index 6e8a9f50..81528b0e 100644 --- a/tests/upload_test.py +++ b/tests/upload_test.py @@ -29,7 +29,7 @@ def get_file_transfer(client: Client) -> FakeFileTransfer: return client.file_transfer # type: ignore[return-value] -@pytest.fixture() +@pytest.fixture def dataset(): return Dataset( access_groups=["group1", "2nd_group"], @@ -51,7 +51,7 @@ def dataset(): ) -@pytest.fixture() +@pytest.fixture def dataset_with_files(dataset, fs): make_file(fs, path="file.nxs", contents=b"contents of file.nxs") make_file(fs, path="the_log_file.log", contents=b"this is a log file") @@ -59,7 +59,7 @@ def dataset_with_files(dataset, fs): return dataset -@pytest.fixture() +@pytest.fixture def attachments(): return [ Attachment( @@ -75,7 +75,7 @@ def attachments(): ] -@pytest.fixture() +@pytest.fixture def client(fs, scicat_access): return FakeClient.from_credentials( url="",