Skip to content

[MAINTENANCE] Resolve datetime deprecation warnings #11134

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

Merged
merged 11 commits into from
May 14, 2025

Conversation

emmanuel-ferdman
Copy link
Contributor

PR Summary

This small PR resolves the deprecation warnings on datetime in Python3.12+:

/home/runner/work/great_expectations/great_expectations/tests/core/test_util.py:17: 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).

/home/runner/work/great_expectations/great_expectations/great_expectations/util.py:839: 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).
  • Description of PR changes above includes a link to an existing GitHub issue
  • PR title is prefixed with one of: [BUGFIX], [FEATURE], [DOCS], [MAINTENANCE], [CONTRIB], [MINORBUMP]
  • Code is linted - run invoke lint (uses ruff format + ruff check)
  • Appropriate tests and docs have been updated

For more information about contributing, visit our community resources.

After you submit your PR, keep the page open and monitor the statuses of the various checks made by our continuous integration process at the bottom of the page. Please fix any issues that come up and reach out on Slack if you need help. Thanks for contributing!

Copy link

netlify bot commented Apr 25, 2025

‼️ Deploy request for niobium-lead-7998 rejected.

Name Link
🔨 Latest commit 2d22bcf

@gx-cla-bot
Copy link

gx-cla-bot bot commented Apr 25, 2025

A new contributor, HUZZAH! Welcome and thanks for joining our community. In order to accept a pull request we require that all contributors sign our Contributor License Agreement. We have two different CLAs, depending on whether you are contributing to GX in a personal or professional capacity. Please sign the one that is applicable to your situation so that we may accept your contribution:

Individual Contributor License Agreement v1.0
Software Grant and Corporate Contributor License Agreement v1.0

Once you have signed the CLA, you can add a comment with the text @cla-bot check and the bot will update the PR status!

Please reach out to the #gx-community-support channel, on our Slack if you have any questions or if you have already signed the CLA and are receiving this message in error.

Users missing a CLA: emmanuel-ferdman

@gx-cla-bot
Copy link

gx-cla-bot bot commented Apr 25, 2025

A new contributor, HUZZAH! Welcome and thanks for joining our community. In order to accept a pull request we require that all contributors sign our Contributor License Agreement. We have two different CLAs, depending on whether you are contributing to GX in a personal or professional capacity. Please sign the one that is applicable to your situation so that we may accept your contribution:

Individual Contributor License Agreement v1.0
Software Grant and Corporate Contributor License Agreement v1.0

Once you have signed the CLA, you can add a comment with the text @cla-bot check and the bot will update the PR status!

Please reach out to the #gx-community-support channel, on our Slack if you have any questions or if you have already signed the CLA and are receiving this message in error.

Users missing a CLA: emmanuel-ferdman

@joshua-stauffer
Copy link
Member

thanks for the PR, @emmanuel-ferdman ! If you could sign the CLA and leave a @cla-bot check comment on the PR, we'll get this merged.

@emmanuel-ferdman
Copy link
Contributor Author

@joshua-stauffer I think I signed it a while ago but I signed it again now

@joshua-stauffer
Copy link
Member

@cla-bot check

Copy link
Member

@joshua-stauffer joshua-stauffer left a comment

Choose a reason for hiding this comment

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

thanks @emmanuel-ferdman , looks great - since you resolved the noqa comment, we can remove the FIXME as well. Much appreciated!

@joshua-stauffer
Copy link
Member

looks like there is a unit test that will need to be updated as well

@emmanuel-ferdman
Copy link
Contributor Author

@joshua-stauffer should be good now, thanks for the review

@NathanFarmer NathanFarmer enabled auto-merge May 13, 2025 17:23
Copy link

codecov bot commented May 13, 2025

❌ 523 Tests Failed:

Tests completed Failed Passed Skipped
13554 523 13031 1144
View the top 3 failed test(s) by shortest run time
tests.integration.data_sources_and_expectations.expectations.test_expect_query_results_to_match_source::test_expect_query_results_to_match_source_success[redshift->redshift-both_results_are_empty]
Stack Traces | 0.003s run time
>       lambda: ihook(item=item, **kwds), when=when, reraise=reraise
    )

.../hostedtoolcache/Python/3.9.22.../x64/lib/python3.9.../site-packages/flaky/flaky_pytest_plugin.py:146: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

_batch_setup_for_datasource = <tests.integration.test_utils.data_source_config.redshift.RedshiftBatchTestSetup object at 0x7f5eaef1c310>
_cached_secondary_test_configs = {UUID('b3cec988-a8e1-47fe-aa8b-72abbc9db7e1'): <tests.integration.test_utils.data_source_config.redshift.RedshiftBatch...bb5b96f0'): <tests.integration.test_utils.data_source_config.redshift.RedshiftBatchTestSetup object at 0x7f5eb7f1e730>}

    @pytest.fixture
    def multi_source_batch(
        _batch_setup_for_datasource: BatchTestSetup,
        _cached_secondary_test_configs: dict[UUID, BatchTestSetup],
    ) -> Generator[MultiSourceBatch, None, None]:
        """Fixture that sets up multiple sources in a single data context."""
>       secondary_batch_setup = _cached_secondary_test_configs[_batch_setup_for_datasource.id]
E       KeyError: UUID('0a097093-c408-4047-8d87-3b290bf10082')

tests/integration/conftest.py:233: KeyError
tests.integration.data_sources_and_expectations.expectations.test_expect_query_results_to_match_source::test_expect_query_results_to_match_source_success[redshift->redshift-column_names_different_values_the_same]
Stack Traces | 0.003s run time
>       lambda: ihook(item=item, **kwds), when=when, reraise=reraise
    )

.../hostedtoolcache/Python/3.9.22.../x64/lib/python3.9.../site-packages/flaky/flaky_pytest_plugin.py:146: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

_batch_setup_for_datasource = <tests.integration.test_utils.data_source_config.redshift.RedshiftBatchTestSetup object at 0x7fc772bc5ee0>
_cached_secondary_test_configs = {UUID('7211058e-2273-41cb-9c21-74139eee4e21'): <tests.integration.test_utils.data_source_config.redshift.RedshiftBatch...f8235bf4'): <tests.integration.test_utils.data_source_config.redshift.RedshiftBatchTestSetup object at 0x7fc7764f9130>}

    @pytest.fixture
    def multi_source_batch(
        _batch_setup_for_datasource: BatchTestSetup,
        _cached_secondary_test_configs: dict[UUID, BatchTestSetup],
    ) -> Generator[MultiSourceBatch, None, None]:
        """Fixture that sets up multiple sources in a single data context."""
>       secondary_batch_setup = _cached_secondary_test_configs[_batch_setup_for_datasource.id]
E       KeyError: UUID('19b608c3-4089-4c73-bb15-e4b44e216184')

tests/integration/conftest.py:233: KeyError
tests.integration.data_sources_and_expectations.expectations.test_expect_query_results_to_match_source::test_expect_query_results_to_match_source_success[redshift->redshift-column_names_different_values_the_same]
Stack Traces | 0.003s run time
>       lambda: ihook(item=item, **kwds), when=when, reraise=reraise
    )

.../hostedtoolcache/Python/3.9.22.../x64/lib/python3.9.../site-packages/flaky/flaky_pytest_plugin.py:146: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

_batch_setup_for_datasource = <tests.integration.test_utils.data_source_config.redshift.RedshiftBatchTestSetup object at 0x7f5eaef1c310>
_cached_secondary_test_configs = {UUID('b3cec988-a8e1-47fe-aa8b-72abbc9db7e1'): <tests.integration.test_utils.data_source_config.redshift.RedshiftBatch...bb5b96f0'): <tests.integration.test_utils.data_source_config.redshift.RedshiftBatchTestSetup object at 0x7f5eb7f1e730>}

    @pytest.fixture
    def multi_source_batch(
        _batch_setup_for_datasource: BatchTestSetup,
        _cached_secondary_test_configs: dict[UUID, BatchTestSetup],
    ) -> Generator[MultiSourceBatch, None, None]:
        """Fixture that sets up multiple sources in a single data context."""
>       secondary_batch_setup = _cached_secondary_test_configs[_batch_setup_for_datasource.id]
E       KeyError: UUID('0a097093-c408-4047-8d87-3b290bf10082')

tests/integration/conftest.py:233: KeyError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@NathanFarmer NathanFarmer added this pull request to the merge queue May 13, 2025
Merged via the queue into great-expectations:develop with commit a3ead68 May 14, 2025
67 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants