Skip to content

Commit 635a536

Browse files
committed
chore: Update ruff srcs to fix detection of first-party modules in isort
Previously, when we imported our own module `codespaces_artifacts_helper_keyring` in tests, it was not being detected by ruff (linter) as a first-party module. This affected the linter's ability to accurately separate import blocks. We fix the issue in this commit by including the `/test` directory in ruff's `src`s. Now, the linter will put our own modules in a separate first-party import block, as expected.
1 parent b63f62d commit 635a536

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/artifacts-helper/codespaces_artifacts_helper_keyring/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ tests = "nox --error-on-external-run -R -s tests -- {args}"
6666
release = "nox --error-on-external-run -R -s release"
6767

6868
[tool.ruff]
69+
# Allow imports relative to the "src" and "test" directories. Also allows ruff's
70+
# isort to determine that our package is first party when importing it in tests.
71+
src = ["src", "test"]
72+
6973
line-length = 88
7074
indent-width = 4
7175

src/artifacts-helper/codespaces_artifacts_helper_keyring/tests/test_artifacts_helper_credential_provider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Optional, Union
66

77
import pytest
8+
89
from codespaces_artifacts_helper_keyring import ArtifactsHelperCredentialProvider
910
from codespaces_artifacts_helper_keyring.artifacts_helper_credential_provider import (
1011
ArtifactsHelperCredentialProviderError,

src/artifacts-helper/codespaces_artifacts_helper_keyring/tests/test_keyring_backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import keyring.backends.chainer
66
import keyring.errors
77
import pytest
8+
from jaraco.classes import properties
9+
810
from codespaces_artifacts_helper_keyring import (
911
ArtifactsHelperCredentialProvider,
1012
CodespacesArtifactsHelperKeyringBackend,
1113
)
12-
from jaraco.classes import properties
1314

1415
# Shouldn't be accessed by tests, but needs to be able
1516
# to get past the quick check.

0 commit comments

Comments
 (0)