Catching exception in test_dup.py