DeprecationWarning: Flags not at the start of expression ...

Issue #665 invalid
Keith Gray
created an issue

I run my tests with PYTHONWARNINGS=error and when I recently updated a project to Python 3.6.5, I receive the following error during my tests:

coverage run --source='.' --omit='*/migrations/*' --branch manage.py test --no-input results
Traceback (most recent call last):
  File "c:\programdata\miniconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\miniconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Miniconda3\Scripts\coverage.exe\__main__.py", line 9, in <module>
  File "c:\programdata\miniconda3\lib\site-packages\coverage\cmdline.py", line 750, in main
    status = CoverageScript().command_line(argv)
  File "c:\programdata\miniconda3\lib\site-packages\coverage\cmdline.py", line 486, in command_line
    return self.do_run(options, args)
  File "c:\programdata\miniconda3\lib\site-packages\coverage\cmdline.py", line 614, in do_run
    self.coverage.erase()
  File "c:\programdata\miniconda3\lib\site-packages\coverage\control.py", line 717, in erase
    self._init()
  File "c:\programdata\miniconda3\lib\site-packages\coverage\control.py", line 351, in _init
    self.omit_match = FnmatchMatcher(self.omit)
  File "c:\programdata\miniconda3\lib\site-packages\coverage\files.py", line 266, in __init__
    self.re = re.compile(join_regex(fnpats))
  File "c:\programdata\miniconda3\lib\re.py", line 233, in compile
    return _compile(pattern, flags)
  File "c:\programdata\miniconda3\lib\re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "c:\programdata\miniconda3\lib\sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "c:\programdata\miniconda3\lib\sre_parse.py", line 856, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, False)
  File "c:\programdata\miniconda3\lib\sre_parse.py", line 415, in _parse_sub
    itemsappend(_parse(source, state, verbose))
  File "c:\programdata\miniconda3\lib\sre_parse.py", line 763, in _parse
    p = _parse_sub(source, state, sub_verbose)
  File "c:\programdata\miniconda3\lib\sre_parse.py", line 415, in _parse_sub
    itemsappend(_parse(source, state, verbose))
  File "c:\programdata\miniconda3\lib\sre_parse.py", line 743, in _parse
    DeprecationWarning, stacklevel=7
DeprecationWarning: Flags not at the start of the expression (?:(?s:.*[\\/]migrat (truncated)

This looks like it might be related to this change in Python: python/cpython@db99e6e.

Please let me know if you need any more information.

Comments (1)

  1. Log in to comment