Skip to content

DeprecationWarning: datetime.datetime.utcnow() on version 1.3.48 (using python 3.12) #733

@rui1610

Description

@rui1610

Description

When running terraform_compliance 1.3.48 with python 3.12 I'm getting multiple DeprecationWarnings on the usage of datetime.datetime.utcnow().

Although terraform_compliance still works, this makes it difficult to read the output.

To Reproduce

Just run terraform_compliance with any feature file on python 3.12

Feature File:

Given I have ....
When it contains ...
Then it must ....
And it must ...

Plan File:

Sample Terraform Code:

resource "aws_s3_bucket" "example_code" {
   bucket = "This is just a sample code"
}

Used terraform-compliance Parameters:

Running via Docker:

Yes

Error Output:

. Converting terraform plan file.
🚩 Features     : /workspaces/tf_btp_info/tfscripts/tests/
🚩 Plan File    : /workspaces/tf_btp_info/tfscripts/mission_3774/step1/plan.out.json

🚩 Running tests. 🎉

/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:38: 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).
  feature.starttime = datetime.utcnow()
Feature: Certain variables should always be defined  # /workspaces/tf_btp_info/tfscripts/tests/naming_standards.feature
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:44: 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).
  scenario.starttime = datetime.utcnow()

    Scenario Outline: Naming Standard on all available variables
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:50: 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).
  step.starttime = datetime.utcnow()
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:68: 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).
  step.endtime = datetime.utcnow()
        Given I have not defined variable foo or moo
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:50: 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).
  step.starttime = datetime.utcnow()
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:68: 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).
  step.endtime = datetime.utcnow()
        Then scenario should fail
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:62: 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).
  scenario.endtime = datetime.utcnow()

    Examples:
        |  |
/usr/local/lib/python3.12/site-packages/radish/extensions/time_recorder.py:56: 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).
  feature.endtime = datetime.utcnow()

1 features (1 passed)
0 scenarios (0 passed)
0 steps (0 passed)

Expected Behavior:

Clean output without deprecation warnings.

Tested Versions:

  • terraform-compliance version: 1.3.48
  • terraform version: 1.9.1
  • python version: 3.12.4

Additional Context:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions