Skip to content

Commit

Permalink
Update ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jl-wynen committed Aug 19, 2024
1 parent d076ab0 commit 423b4ec
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
6 changes: 3 additions & 3 deletions src/scitacean/testing/backend/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/scitacean/testing/sftp/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions tests/client/attachment_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
Expand All @@ -43,7 +43,7 @@ def derived_dataset(scicat_access):
)


@pytest.fixture()
@pytest.fixture
def attachment(scicat_access):
return UploadAttachment(
caption="An attachment",
Expand Down
6 changes: 3 additions & 3 deletions tests/client/datablock_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
Expand All @@ -40,7 +40,7 @@ def derived_dataset(scicat_access):
)


@pytest.fixture()
@pytest.fixture
def orig_datablock(scicat_access):
# NOTE the placeholder!
return UploadOrigDatablock(
Expand Down
4 changes: 2 additions & 2 deletions tests/client/dataset_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions tests/client/sample_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -25,7 +25,7 @@ def ingestor_access(
)


@pytest.fixture()
@pytest.fixture
def real_client(
request: pytest.FixtureRequest,
ingestor_access: backend_config.SciCatAccess,
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .common.files import make_file


@pytest.fixture()
@pytest.fixture
def raw_download_model():
return model.DownloadDataset(
contactEmail="[email protected]",
Expand Down Expand Up @@ -86,7 +86,7 @@ def raw_download_model():
)


@pytest.fixture()
@pytest.fixture
def derived_download_model():
return model.DownloadDataset(
contactEmail="[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions tests/download_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -41,7 +41,7 @@ def data_files():
return files, contents


@pytest.fixture()
@pytest.fixture
def dataset_and_files(data_files):
model = DownloadDataset(
contactEmail="[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion tests/file_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down
4 changes: 2 additions & 2 deletions tests/transfer/sftp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions tests/upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -51,15 +51,15 @@ 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")
dataset.add_local_files("file.nxs", "the_log_file.log")
return dataset


@pytest.fixture()
@pytest.fixture
def attachments():
return [
Attachment(
Expand All @@ -75,7 +75,7 @@ def attachments():
]


@pytest.fixture()
@pytest.fixture
def client(fs, scicat_access):
return FakeClient.from_credentials(
url="",
Expand Down

0 comments on commit 423b4ec

Please sign in to comment.