joalla / discogs_client

Continuation of the "Official Python Client for the Discogs API"
https://python3-discogs-client.readthedocs.io
Other
299 stars 49 forks source link

Errors and warnings on python 3.12 #140

Open arogl opened 9 months ago

arogl commented 9 months ago
pytest                                                                                                                                                              in cmd at 12:01:22
========================================================================================================= test session starts =========================================================================================================
platform win32 -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0
rootdir: i:\Git\discogs_client
plugins: anyio-4.2.0, typeguard-4.1.5
collected 50 items

discogs_client\tests\test_core.py ............                                                                                                                                                                                   [ 24%]
discogs_client\tests\test_fetchers.py ..                                                                                                                                                                                         [ 28%]
discogs_client\tests\test_models.py ...F.........................                                                                                                                                                                [ 86%]
discogs_client\tests\test_utils.py .......                                                                                                                                                                                       [100%]

============================================================================================================== FAILURES ===============================================================================================================
________________________________________________________________________________________________ ModelsTestCase.test_collection_value _________________________________________________________________________________________________

self = <discogs_client.tests.test_models.ModelsTestCase testMethod=test_collection_value>

    def test_collection_value(self):
        """Collection Value can be fetched and parsed"""
        u = self.d.user("example")

        self.assertEqual(isinstance(u.collection_value, CollectionValue), True)
>       self.assertEqual(u.collection_value.minimum, "£1.05")
E       AssertionError: '£1.05' != '£1.05'
E       - £1.05
E       ? -
E       + £1.05

discogs_client\tests\test_models.py:351: AssertionError
========================================================================================================== warnings summary ===========================================================================================================
C:\Python3\Lib\site-packages\dateutil\tz\tz.py:37
  C:\Python3\Lib\site-packages\dateutil\tz\tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    EPOCH = datetime.datetime.utcfromtimestamp(0)

discogs_client\utils.py:102
  i:\Git\discogs_client\discogs_client\utils.py:102: DeprecationWarning: In 3.13 classes created inside an enum will not become a member.  Use the `member` decorator to keep the current behavior.
    class By(Enum):

discogs_client\utils.py:123
  i:\Git\discogs_client\discogs_client\utils.py:123: DeprecationWarning: In 3.13 classes created inside an enum will not become a member.  Use the `member` decorator to keep the current behavior.
    class Order(Enum):

discogs_client\fetchers.py:227
  i:\Git\discogs_client\discogs_client\fetchers.py:227: SyntaxWarning: invalid escape sequence '\w'
    path_with_params = re.compile('(?P<dir>(\w+/)+)(?P<query>\w+)\?(?P<params>.*)')

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================================= short test summary info =======================================================================================================
FAILED discogs_client/tests/test_models.py::ModelsTestCase::test_collection_value - AssertionError: '£1.05' != '£1.05'
============================================================================================== 1 failed, 49 passed, 4 warnings in 8.81s ===============================================================================================

The enum warning might be fixed with a decorator. I put the regex into regex101 but it says it is valid, will need to look deeper into regex warning.

The error could be a windows thing 😒

The timezone error I'll try to look at as well

ncrothers commented 6 months ago

The regex warning goes away if you make the string r'...' instead of '...'.

arogl commented 6 months ago

The regex warning goes away if you make the string r'...' instead of '...'.

@ncrothers This is fixed in the #141 PR

@JOJ0 I'll look to update the dateutil issue as well now a new version has been released.