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

Resolve timezone deprecation warnings #1661

Merged
merged 11 commits into from
Jun 20, 2024

Conversation

chrisjbremner
Copy link
Contributor

I see lots of deprecation warnings when running tests in Python 3.12:

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).
    await self.current_time_node.write_value(datetime.utcnow())

Instead of the suggested datetime.datetime.now(datetime.UTC), I chose to use datetime.datetime.now(datetime.timezone.utc) since the latter is compatible with Python 3.7 whereas the former is only compatible with Python 3.11.

@chrisjbremner chrisjbremner requested review from oroulet and removed request for oroulet June 19, 2024 01:55
@chrisjbremner chrisjbremner marked this pull request as draft June 19, 2024 02:43
@@ -23,7 +23,7 @@
packages=find_packages(exclude=["tests"]),
provides=["asyncua"],
license="GNU Lesser General Public License v3 or later",
install_requires=["aiofiles", "aiosqlite", "python-dateutil", "pytz", "cryptography>40.0.1", "sortedcontainers", "importlib-metadata;python_version<'3.8'", "pyOpenSSL>23.2.0", "typing-extensions"],
install_requires=["aiofiles", "aiosqlite", "python-dateutil", "pytz", "cryptography>42.0.0", "sortedcontainers", "importlib-metadata;python_version<'3.8'", "pyOpenSSL>23.2.0", "typing-extensions"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should already be this since not_valid_after_utc is used here, but this function was added in cryptography==42.0.0

@chrisjbremner chrisjbremner marked this pull request as ready for review June 19, 2024 23:08
@chrisjbremner chrisjbremner requested a review from oroulet June 19, 2024 23:09
@oroulet
Copy link
Member

oroulet commented Jun 20, 2024

good work. I never found the 3.7 compatible hack

@oroulet oroulet merged commit 9aedc20 into FreeOpcUa:master Jun 20, 2024
5 checks passed
@chrisjbremner chrisjbremner deleted the remove_warnings branch June 20, 2024 13:04
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

Successfully merging this pull request may close these issues.

2 participants