Skip to content

Commit 16a6b15

Browse files
author
d.kovalenko
committed
test_E02__external_modification is corrected
1 parent 0404715 commit 16a6b15

File tree

1 file changed

+9
-9
lines changed
  • tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/DoWork

1 file changed

+9
-9
lines changed

tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/DoWork/test_set001__work.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,18 +372,18 @@ def test_E02__external_modification(self, request: pytest.FixtureRequest):
372372
assert fileContent_n == "port = 123\nlisten_addresses = '*'\n"
373373

374374
mdate1 = file.m_FileData.m_LastModifiedTimestamp
375+
assert type(mdate1) == datetime.datetime
375376
logging.info("Last1 modification date is [{0}]".format(mdate1))
376377

377-
time.sleep(0.001)
378+
mdate2 = mdate1 + datetime.timedelta(seconds=1)
379+
assert mdate2 != mdate1
380+
mdate2_ts = mdate2.timestamp()
381+
os.utime(file.get_Path(), (mdate2_ts, mdate2_ts))
378382

379-
with open(file.get_Path(), "w") as f:
380-
f.write("BLA_BLA-BLA")
381-
f.flush()
382-
f.close()
383-
384-
mdate2 = datetime.datetime.fromtimestamp(os.path.getmtime(file.get_Path()))
385-
logging.info("Last2 modification date is [{0}]".format(mdate2))
386-
assert mdate1 != mdate2
383+
mdate2c = datetime.datetime.fromtimestamp(os.path.getmtime(file.get_Path()))
384+
logging.info("Last2 modification date is [{0}]".format(mdate2c))
385+
assert mdate2 == mdate2c
386+
assert mdate1 != mdate2c
387387

388388
cfg.SetOptionValue("port", 321)
389389

0 commit comments

Comments
 (0)