schireson / pytest-mock-resources

Pytest Fixtures that let you actually test against external resource (Postgres, Mongo, Redshift...) dependent code.
https://pytest-mock-resources.readthedocs.io/en/latest/quickstart.html
MIT License
179 stars 19 forks source link

URL deprecation in source #120

Closed GabrieleLabanca closed 3 years ago

GabrieleLabanca commented 3 years ago

When converting a Postgres fixture to url as in the docs, I get the following error

tests/test_sample_db_mocking.py::test_sql_sum
  /home/gab/doc/supplybrain-data-validator/.venv/lib/python3.8/site-packages/pytest_mock_resources/fixture/database/generic.py:34: SADeprecationWarning: Calling URL() directly is deprecated and will be disabled in a future release.  The public constructor for URL is now the URL.create() method.
    return URL(

Which relates to this line.

I expect that the correction would be simply something like

return URL.create(
DanCardin commented 3 years ago

Ah yes. This is mostly complicated by the fact that it deprecated the <1.4 syntax in the same version that it added the new method, so there's not a fantastic way to support both.

Not that it's impossible/hard, just not as straightforward as not using the deprecated constructor!

DanCardin commented 3 years ago

Should be fixed in 2.1.3

GabrieleLabanca commented 3 years ago

Great, thanks for the answer :)