'When calling a second time gen_filenames with only_new = True, only
files from newly loaded modules should be given.'

def test_only_new_files(self):

    dirname = tempfile.mkdtemp()
    filename = os.path.join(dirname, 'test_only_new_module.py')
    self.addCleanup(shutil.rmtree, dirname)
    with open(filename, 'w'):
        pass
    self.clear_autoreload_caches()
    filenames = set(autoreload.gen_filenames(only_new=True))
    filenames_reference = set(autoreload.gen_filenames())
    self.assertEqual(filenames, filenames_reference)
    filenames = set(autoreload.gen_filenames(only_new=True))
    self.assertEqual(filenames, set())
    with extend_sys_path(dirname):
        import_module('test_only_new_module')
    filenames = set(autoreload.gen_filenames(only_new=True))
    self.assertEqual(filenames, {filename})
