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

Update support for Python 3.12 in testing #846

Merged
merged 26 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
593e129
Add latest Python to the test matrix to detrmine GH Actions support
machawk1 Nov 8, 2023
12e7dda
Add explicit installation of setuptools while testing for #814
machawk1 Nov 8, 2023
76ef7bd
Add six to the test requirements for Py 3.12 GH Action for #814
machawk1 Nov 8, 2023
578aff2
Merge branch 'master' into issue-814
machawk1 Nov 8, 2023
c01462a
Rm six from requirements for #814
machawk1 Nov 8, 2023
8bb2931
Use packaging module to compare versions for #814
machawk1 Nov 8, 2023
cd03823
Merge branch 'master' into issue-814
machawk1 Nov 9, 2023
31e8beb
Rebase
machawk1 Apr 24, 2024
e88627a
Rm usage of deprecated pkg_resources for path resolution
machawk1 Apr 24, 2024
cf5187b
Update mock assertion method for Py 3.12 for #814
machawk1 Apr 24, 2024
7cf144b
Tweak test params for #814
machawk1 Apr 24, 2024
c166c77
Rv test param for #814
machawk1 Apr 24, 2024
a996944
Merge branch 'master' into issue-814
machawk1 Jul 11, 2024
d11339c
Add space to invoke GH testing
machawk1 Oct 16, 2024
17ed3f8
Rm space
machawk1 Oct 16, 2024
a0a7ef0
Merge branch 'master' into issue-814
machawk1 Oct 16, 2024
d0462e9
Update mock assertion
machawk1 Oct 16, 2024
45bc18a
Update parameters for mock logged assertion
machawk1 Oct 16, 2024
ccdb745
Rm extra param for assertion
machawk1 Oct 16, 2024
85ae757
Rm package_resources from replay due to lack of Py 3.12 support
machawk1 Oct 16, 2024
b6a288e
Replace placeholder string in assertion
machawk1 Oct 16, 2024
48c1ba1
Not once, with
machawk1 Oct 16, 2024
d904413
Rm assert
machawk1 Oct 16, 2024
68fabe7
Restore boo
machawk1 Oct 16, 2024
b8273d6
Restore called once assertion
machawk1 Oct 16, 2024
33abe92
Need with 'with' variant of the assert method if passing the param, f…
machawk1 Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Loading