Skip to content

Commit

Permalink
Merge pull request #846 from oduwsdl/issue-814
Browse files Browse the repository at this point in the history
Update support for Python 3.12 in testing
  • Loading branch information
machawk1 authored Oct 16, 2024
2 parents a20def2 + 33abe92 commit 79359a5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- macos-latest
# - windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
ipfs:
- "0.28"
- "0.29"
Expand Down
6 changes: 3 additions & 3 deletions ipwb/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def exception_logger(catch=True, exception_class=Exception):
"""
Decorator which catches exceptions in the function and logs them.
Decorator that catches exceptions in the function and logs them.
Usage:
Expand All @@ -17,11 +17,11 @@ def decorated_function(foo, bar):
do_something
```
`exception_logger()` will catch any exception which happens in
`exception_logger()` will catch any exception that happens in
`decorated_function()` while it is being executed, and log an error using
Python built in `logging` library.
Unless `catch` argument is `False` - in which case the exception will be
Unless `catch` argument is `False` - in which case, the exception will be
reraised.
"""
def decorator(f: Callable):
Expand Down
6 changes: 3 additions & 3 deletions ipwb/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

import sys
import os
import importlib.resources
import ipfshttpclient as ipfsapi
import json
import subprocess
import pkg_resources
import surt
import re
import traceback
Expand Down Expand Up @@ -1018,8 +1018,8 @@ def get_index_file_full_path(cdxj_file_path=INDEX_FILE):
if os.path.isfile(cdxj_file_path):
return cdxj_file_path

index_file_name = pkg_resources.resource_filename(
__name__, index_file_path)
index_file_name = importlib.resources.files(
__name__).joinpath(index_file_path)
return index_file_name


Expand Down
2 changes: 1 addition & 1 deletion ipwb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from ipfshttpclient.exceptions import ConnectionError, AddressError
from multiaddr.exceptions import StringParseError
from pkg_resources import parse_version
from packaging.version import parse as parse_version

from .exceptions import IPFSDaemonNotAvailable

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ requests>=2.19.1
beautifulsoup4>=4.6.3
surt>=0.3.0
multiaddr >= 0.0.9
packaging==23.0
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ flake8>=3.7.9
pytest>=5.3.5
pytest-cov
pytest-flake8
setuptools
4 changes: 2 additions & 2 deletions tests/test_error_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, patch, ANY

from ipwb.error_handler import exception_logger

Expand All @@ -24,4 +24,4 @@ def test_catch():
with patch('ipwb.error_handler.logger.critical', mock_logger):
caught_error('boo')

assert mock_logger.called_once_with(('boo', ))
mock_logger.assert_called_once_with('boo')

0 comments on commit 79359a5

Please sign in to comment.