Actions
Feature #22178
openStop using deprecated datetime.datetime.utc* constructors
Status:
New
Priority:
Normal
Assigned To:
-
Category:
SDKs
Target version:
-
Story points:
-
Description
Python 3.13 deprecates the functions datetime.datetime.utcnow
and datetime.datetime.utcfromtimestamp
and they're pending removal in a future version, because the API is basically a footgun and a source of constant bugs.
The release notes include suggested replacements. We use these functions a lot in the current code so getting through them all is going to be a chore. This even causes a test failure:
___________________________________________ ArvPutIntegrationTest.test_silent_mode_no_errors ____________________________________________ self = <tests.test_arv_put.ArvPutIntegrationTest testMethod=test_silent_mode_no_errors> def test_silent_mode_no_errors(self): self.authorize_with('active') tmpdir = self.make_tmpdir() with open(os.path.join(tmpdir, 'test.txt'), 'w') as f: f.write('hello world') pipe = subprocess.Popen( [sys.executable, arv_put.__file__] + ['--silent', tmpdir], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.ENVIRON) stdout, stderr = pipe.communicate() # No console output should occur on normal operations > self.assertNotRegex(stderr.decode(), r'.+') E AssertionError: Regex matched: '/home/brett/Curii/arvados/sdk/python/arvados/commands/put.py:1200: 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).' matches '.+' in '/home/brett/Curii/arvados/sdk/python/arvados/commands/put.py:1200: 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).\n datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC"),\n' tests/test_arv_put.py:1510: AssertionError
No data to display
Actions