Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-37808: Update pre-commit dependencies #39

Merged
merged 6 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.8
language_version: python3.10
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion doc/changes/DM-36799.misc.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Added allow_redirects=True to HEAD requests since the default is False. This
is needed when interacting with WEBDAV storage systems which have a frontend
is needed when interacting with WEBDAV storage systems which have a frontend
redirecting to backend servers.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ version = { attr = "lsst_versions.get_lsst_version" }

[tool.black]
line-length = 110
target-version = ["py38"]
target-version = ["py310"]

[tool.isort]
profile = "black"
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/resources/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ def test_open(self) -> None:
_check_open(self, tmp, mode_suffixes=("t",), encoding="utf-16", prefer_file_temporary=True)
with ResourcePath.temporary_uri(prefix=tmpdir, suffix=".dat") as tmp:
_check_open(self, tmp, mode_suffixes=("b",))
_check_open(self, tmp, mode_suffixes=("b"), prefer_file_temporary=True)
_check_open(self, tmp, mode_suffixes=("b",), prefer_file_temporary=True)

with self.assertRaises(IsADirectoryError):
with self.root_uri.open():
Expand Down
12 changes: 0 additions & 12 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def test_file_handle(self):

@responses.activate
def test_exists(self):

self.assertTrue(self.existingFileResourcePath.exists())
self.assertFalse(self.notExistingFileResourcePath.exists())

Expand All @@ -257,7 +256,6 @@ def test_exists(self):

@responses.activate
def test_remove(self):

self.assertIsNone(self.existingFileResourcePath.remove())
with self.assertRaises(FileNotFoundError):
self.notExistingFileResourcePath.remove()
Expand All @@ -269,7 +267,6 @@ def test_remove(self):

@responses.activate
def test_mkdir(self):

# The mock means that we can't check this now exists
self.notExistingFolderResourcePath.mkdir()

Expand All @@ -281,7 +278,6 @@ def test_mkdir(self):

@responses.activate
def test_read(self):

self.assertEqual(self.existingFileResourcePath.read().decode(), "It works!")
self.assertNotEqual(self.existingFileResourcePath.read().decode(), "Nope.")
with self.assertRaises(FileNotFoundError):
Expand All @@ -305,7 +301,6 @@ def test_read(self):

@responses.activate
def test_write(self):

self.assertIsNone(self.existingFileResourcePath.write(data=str.encode("Some content.")))
with self.assertRaises(FileExistsError):
self.existingFileResourcePath.write(data=str.encode("Some content."), overwrite=False)
Expand All @@ -317,7 +312,6 @@ def test_write(self):

@responses.activate
def test_do_put_with_redirection(self):

# Without LSST_HTTP_PUT_SEND_EXPECT_HEADER.
os.environ.pop("LSST_HTTP_PUT_SEND_EXPECT_HEADER", None)
importlib.reload(lsst.resources.http)
Expand All @@ -331,7 +325,6 @@ def test_do_put_with_redirection(self):

@responses.activate
def test_transfer(self):

# Transferring to self should be no-op.
self.existingFileResourcePath.transfer_from(src=self.existingFileResourcePath)

Expand All @@ -357,7 +350,6 @@ def test_transfer(self):
)

def test_parent(self):

self.assertEqual(
self.existingFolderResourcePath.geturl(), self.notExistingFileResourcePath.parent().geturl()
)
Expand All @@ -367,7 +359,6 @@ def test_parent(self):
)

def test_send_expect_header(self):

# Ensure _SEND_EXPECT_HEADER_ON_PUT is correctly initialized from
# the environment.
os.environ.pop("LSST_HTTP_PUT_SEND_EXPECT_HEADER", None)
Expand All @@ -379,7 +370,6 @@ def test_send_expect_header(self):
self.assertTrue(lsst.resources.http._SEND_EXPECT_HEADER_ON_PUT)

def test_timeout(self):

connect_timeout = 100
read_timeout = 200
with unittest.mock.patch.dict(
Expand All @@ -392,7 +382,6 @@ def test_timeout(self):
self.assertEqual(lsst.resources.http.TIMEOUT, (connect_timeout, read_timeout))

def test_is_protected(self):

self.assertFalse(_is_protected("/this-file-does-not-exist"))

with tempfile.NamedTemporaryFile(mode="wt", dir=self.tmpdir.ospath, delete=False) as f:
Expand All @@ -419,7 +408,6 @@ def setUp(self):

@responses.activate
def test_is_webdav_endpoint(self):

self.assertTrue(_is_webdav_endpoint(f"https://{self.serverRoot}"))
self.assertFalse(_is_webdav_endpoint(f"https://{self.wrongRoot}"))

Expand Down