nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 395 forks source link

nosetest ran in pre-commit with -I and globbing will throw an error #1085

Closed Seluj78 closed 6 years ago

Seluj78 commented 6 years ago

.pre-commit-config.yaml

repos:
-   repo: https://github.com/ambv/black
    rev: stable
    hooks:
    - id: black
      args: [--line-length=119]
      language_version: python3.6
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v1.4.0
    hooks:
    - id: flake8
-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.630
    hooks:
    -   id: mypy
-   repo: local
    hooks:
    - id: nosetests
      name: nosetests
      entry: nosetests -I *.yml *.yaml
      language: python
      python_version: python3.6

ouput:

{10:08}~/uai-api:master ✗ ➭ git commit -m "Added travis.yml"
Alias tip: gcmsg "Added travis.yml"
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/seluj78/.cache/pre-commit/patch1539331717.
black................................................(no files to check)Skipped
Flake8...............................................(no files to check)Skipped
mypy.................................................(no files to check)Skipped
nosetests................................................................Failed
hookid: nosetests

Traceback (most recent call last):
  File "/home/seluj78/.local/bin/nosetests", line 11, in <module>
    sys.exit(run_exit())
  File "/home/seluj78/.local/lib/python3.6/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python3.6/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/home/seluj78/.local/lib/python3.6/site-packages/nose/core.py", line 145, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/home/seluj78/.local/lib/python3.6/site-packages/nose/config.py", line 331, in configure
    self.ignoreFiles = list(map(re.compile, tolist(options.ignoreFiles)))
  File "/usr/lib/python3.6/re.py", line 233, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python3.6/re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.6/sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.6/sre_parse.py", line 855, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.6/sre_parse.py", line 416, in _parse_sub
    not nested and not items))
  File "/usr/lib/python3.6/sre_parse.py", line 616, in _parse
    source.tell() - here + len(this))
sre_constants.error: nothing to repeat at position 0
jszakmeister commented 6 years ago

Thank you for the bug report, but Nose is no longer maintained. You should really look at Nose2.

Seluj78 commented 6 years ago

I think it was done with nose2 ? Not sure anymore

Seluj78 commented 6 years ago

I think it was done with nose2 ? Not sure anymore

jszakmeister commented 6 years ago

FWIW, it looks like nose and not nose2. Nose definitely has some issues with later versions of Python 3.