Skip to content

Commit

Permalink
replace WindowsError with OSError
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Dec 18, 2024
1 parent c3dce20 commit 706383e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions psutil/tests/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def test_num_handles(self):

def test_error_partial_copy(self):
# https://github.com/giampaolo/psutil/issues/875
exc = WindowsError()
exc = OSError()
exc.winerror = 299
with mock.patch("psutil._psplatform.cext.proc_cwd", side_effect=exc):
with mock.patch("time.sleep") as m:
Expand Down Expand Up @@ -883,7 +883,7 @@ def test_win_service_get(self):

# test NoSuchProcess
service = psutil.win_service_get(name)
exc = WindowsError(0, "msg", 0, ERROR_SERVICE_DOES_NOT_EXIST)
exc = OSError(0, "msg", 0, winerror=ERROR_SERVICE_DOES_NOT_EXIST)
with mock.patch(
"psutil._psplatform.cext.winservice_query_status", side_effect=exc
):
Expand All @@ -896,7 +896,7 @@ def test_win_service_get(self):
service.username()

# test AccessDenied
exc = WindowsError(0, "msg", 0, ERROR_ACCESS_DENIED)
exc = OSError(0, "msg", 0, winerror=ERROR_ACCESS_DENIED)
with mock.patch(
"psutil._psplatform.cext.winservice_query_status", side_effect=exc
):
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ ignore = [
"TD", # all TODOs, XXXs, etc.
"TRY300", # Consider moving this statement to an `else` block
"TRY301", # Abstract `raise` to an inner function
"UP024", # [*] Replace aliased errors with `OSError` (PYTHON2.7 COMPAT)
"UP031", # [*] Use format specifiers instead of percent format
]

Expand Down

0 comments on commit 706383e

Please sign in to comment.