          os.chdir(self.test_dir)
          pattern1 = os.path.join('ignore_dir', '*')
          stdout = StringIO()
          management.call_command('makemessages', locale=LOCALE, verbosity=2,
              ignore_patterns=[pattern1], stdout=stdout)
          data = stdout.getvalue()
          self.assertTrue("ignoring directory ignore_dir" in data)
          self.assertTrue(os.path.exists(self.PO_FILE))
          with open(self.PO_FILE, 'r') as fp:
              po_contents = fp.read()
 
</s> remove         pattern1 = os.path.join('ignore_dir', '*')
 </s> add         ignore_patterns = [
            os.path.join('ignore_dir', '*'),
            'xxx_*',
        ] </s> remove             for pattern in ignore_patterns:
                if fnmatch.fnmatchcase(path, pattern):
                    return True
            return False
 </s> add             filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)
            ignore_patterns=ignore_patterns, stdout=stdout)
          os.chdir(self.test_dir)
          pattern1 = os.path.join('ignore_dir', '*')
          stdout = StringIO()
          management.call_command('makemessages', locale=LOCALE, verbosity=2,
            ignore_patterns=ignore_patterns, stdout=stdout)
          data = stdout.getvalue()
          self.assertTrue("ignoring directory ignore_dir" in data)
          self.assertTrue(os.path.exists(self.PO_FILE))
          with open(self.PO_FILE, 'r') as fp:
              po_contents = fp.read()
keep keep keep keep replace keep keep keep keep keep
 Fixed #20422 -- Applied makemessage's --ignore patterns to full path

Fix makemessage's --ignore patterns being applied to the full path
instead of the file name. Thanks to nnseva for the report and the
original patch. 
tests/i18n/commands/extraction.py