aws-sdk-pandas icon indicating copy to clipboard operation
aws-sdk-pandas copied to clipboard

Investigate transient failure in test_timestream unit test

Open EthanBunce opened this issue 5 months ago • 0 comments

Describe the bug

Unit tests are transiently failing with similar errors to below. One possible explanation is it is dropping a trailing 0, thus failing the test. This would lead to a failure rate of 10%.

We should investigate this further to improve the unit test reliability.

=================================== FAILURES ===================================
___________________ test_time_unit_precision[MICROSECONDS-6] ___________________
[gw15] linux -- Python 3.9.2 /codebuild/output/src2263616497/src/github.com/aws/aws-sdk-pandas/.venv/bin/python3
timestream_database_and_table = 'tbl_20250616111618312269_386726'
time_unit = 'MICROSECONDS', precision = 6
    @pytest.mark.parametrize(
        "time_unit,precision",
        [(None, 3), ("SECONDS", 1), ("MILLISECONDS", 3), ("MICROSECONDS", 6)],
    )
    def test_time_unit_precision(timestream_database_and_table, time_unit, precision):
        df_write = pd.DataFrame(
            {
                "time": [datetime.now()] * 3,
                "dim0": ["foo", "boo", "bar"],
                "dim1": [1, 2, 3],
                "measure0": ["a", "b", "c"],
                "measure1": [1.0, 2.0, 3.0],
            }
        )
    
        rejected_records = wr.timestream.write(
            df=df_write,
            database=timestream_database_and_table,
            table=timestream_database_and_table,
            time_col="time",
            time_unit=time_unit,
            measure_col=["measure0", "measure1"],
            dimensions_cols=["dim0", "dim1"],
            measure_name="example",
        )
        assert len(rejected_records) == 0
    
        df_query = wr.timestream.query(
            f"""
            SELECT
                *
            FROM "{timestream_database_and_table}"."{timestream_database_and_table}"
            """,
        )
>       assert len(str(df_query["time"][0].timestamp()).split(".")[1]) == precision
E       AssertionError: assert 5 == 6
E        +  where 5 = len('90541')

How to Reproduce

Run the unit tests.

Expected behavior

No response

Your project

No response

Screenshots

No response

OS

Windows

Python version

All

AWS SDK for pandas version

All

Additional context

No response

EthanBunce avatar Jun 16 '25 14:06 EthanBunce