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

Fix deprecation warnings #234

Open
StevenMaude opened this issue Nov 16, 2023 · 0 comments
Open

Fix deprecation warnings #234

StevenMaude opened this issue Nov 16, 2023 · 0 comments

Comments

@StevenMaude
Copy link
Contributor

When testing with Python 3.12, there are several warnings. These are a mixture of:

tests/conftest.py:10
  /home/runner/work/opensafely-cli/opensafely-cli/tests/conftest.py:10: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

opensafely/_vendor/certifi/core.py:36
  /home/runner/work/opensafely-cli/opensafely-cli/opensafely/_vendor/certifi/core.py:36: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    _CACERT_CTX = get_path("opensafely._vendor.certifi", "cacert.pem")

opensafely/_vendor/google/protobuf/internal/well_known_types.py:91
  /home/runner/work/opensafely-cli/opensafely-cli/opensafely/_vendor/google/protobuf/internal/well_known_types.py:91: 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_NAIVE = datetime.datetime.utcfromtimestamp(0)

opensafely/_vendor/opentelemetry/sdk/trace/__init__.py:1162
  /home/runner/work/opensafely-cli/opensafely-cli/opensafely/_vendor/opentelemetry/sdk/trace/__init__.py:1162: DeprecationWarning: Call to deprecated method __init__. (You should use InstrumentationScope) -- Deprecated since version 1.11.1.
    InstrumentationInfo(

tests/test_codelists.py::test_codelists_update
tests/test_codelists.py::test_codelists_update
  /home/runner/work/opensafely-cli/opensafely-cli/opensafely/codelists.py:89: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    "downloaded_at": f"{datetime.datetime.utcnow()}Z",

tests/test_init.py::test_should_version_check
tests/test_init.py::test_should_version_check
  /home/runner/work/opensafely-cli/opensafely-cli/opensafely/__init__.py:45: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    four_hours_ago = datetime.utcnow() - timedelta(hours=4)

tests/test_init.py::test_should_version_check
  /home/runner/work/opensafely-cli/opensafely-cli/tests/test_init.py:14: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    timestamp = (datetime.utcnow() - timedelta(hours=5)).timestamp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant