Skip to content

Commit

Permalink
Merge pull request #2974 from bruntib/fix_fixit_test
Browse files Browse the repository at this point in the history
Fix in fixit test related to file modification time
  • Loading branch information
bruntib authored Oct 16, 2020
2 parents 2889ea1 + 6f0b928 commit 9798bd2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions analyzer/tests/functional/fixit/test_fixit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"""


import datetime
import json
import os
import pathlib
import shutil
import subprocess
import time
import unittest

from distutils.spawn import find_executable
Expand Down Expand Up @@ -211,7 +212,12 @@ def test_fixit_file_modification(self):
'Skipped files due to modification since last analysis',
err)

pathlib.Path(source_file_cpp).touch()
# We're setting the timestamp if the file one hour forward so we
# simulate file modification. In this case the fixits are not applied
# and this is also printed to the standard output.
date = datetime.datetime.now() + datetime.timedelta(hours=1)
mod_time = time.mktime(date.timetuple())
os.utime(source_file_cpp, (mod_time, mod_time))

process = subprocess.Popen(
[self._codechecker_cmd, 'fixit', self.report_dir],
Expand Down

0 comments on commit 9798bd2

Please sign in to comment.