Updating generated file
You don't need to manually call f.close(), that's what the with is for.
It looks like line = line.replace(line, "".join(dummy)) can just be line = "".join(dummy).
It's clearer to define dummy in the if statement:


This means that it's in the correct scope, meaning we don't have to look out for it being used elsewhere.
It also means that you can remove dummy.clear().

Personally I would merge your two if statements together, to reduce the arrow anti-pattern.
It looks like dummy and your for loop can be replaced with str.maketrans and str.translate.


untested

file_name = "test.v"
test = ".test"
tezt = ".tezt"
trans_table = str.maketrans({'(': '(/*', ')': '*/)'})

with open(file_name, "r+") as f:
    lines = f.readlines()
    f.seek(0)
    f.truncate()
    for line in lines:
        if ((test in line or tezt in line)
            and line[line.index('(') + 1] != '/'
        ):
            line = line.translate(trans_table)
        f.write(line)