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

Python deprecation fixes #309

Merged
merged 8 commits into from
Sep 10, 2024
Merged

Python deprecation fixes #309

merged 8 commits into from
Sep 10, 2024

Conversation

tohojo
Copy link
Owner

@tohojo tohojo commented Sep 10, 2024

Setuptools v72 deprecated the 'setup.py test' command, so stop using that for
running tests. Instead, execute the 'unittest' module directly, using our
protocol to pass the test suite name as an environment variable to the module
test loader.

Python 3.12 also deprecated datetime.utc*(), so add our own implementations to continue using them.

Setuptools v72 deprecated the 'setup.py test' command, so stop using that for
running tests. Instead, execute the 'unittest' module directly, using our
protocol to pass the test suite name as an environment variable to the module
test loader.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Python 3.12 deprecated datetime.utcnow() and datetime.utcfromtimestamp() in an
attempt to move users away from the naive datetime representations. However, we
already do all our own UTC offset handling, and we need to continue to do so to
stay backwards compatible, cf commit: 5f15409 ("resultset: Guess timezone
offset from data instead of using system time"). So we really want to keep using
the naive representations; so implement our own versions of the deprecated
functions and keep using those.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
The heading of the default SummaryFormatter output didn't use the format_date()
wrapper to handle UTC conversions correctly, which meant it output wrong dates
for the test runs. Fix this by correctly using the helper.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Old Python versions don't define datetime.UTC, so conditionally import it and
just use the old datetime.utcnow() and datetime.utcfromtimestamp() functions on
those Python versions.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
@tohojo tohojo changed the title Makefile: Don't use 'setup.py test' to run unittests Python deprecation fixes Sep 10, 2024
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Exclude some more version combinations that seem to cause crashes on fork() when
using PySide2.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
@tohojo tohojo merged commit 32ec7ee into master Sep 10, 2024
63 checks passed
@tohojo tohojo deleted the unittest-runner branch September 10, 2024 15:13
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.

1 participant