Pytest-django: OSError on long command-line args

Created on 10 Oct 2018  路  4Comments  路  Source: pytest-dev/pytest-django

In the logic of django_find_project there exist these lines:

    def find_django_path(args):
        args = map(str, args)
        args = [arg_to_path(x) for x in args if not x.startswith("-")]
        args = [p for p in args if p.is_dir()]
...

Unfortunately, this means that if there are really long command-line args that this can get a OSError: [Errno 36] File name too long: ... which prevents me from, for example, using really long args to pytest's -k option.
Thanks for looking into this.

bug

All 4 comments

Please consider creating a failing test and fix for this yourself.
I assume the args = [p for p in args if p.is_dir()] should be turned into a loop that try/catches any OSError and ignores it.

/cc @voidus for the pathlib change that appears to trigger this

I'm sorry that my change caused these bugs and that I usually take a while to look into them. Definitely keep cc'ing me though! :bowing_man:

Thanks a lot for fixing so fast!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blueyed picture blueyed  路  7Comments

mpasternak picture mpasternak  路  5Comments

rodrigorodriguescosta picture rodrigorodriguescosta  路  4Comments

jedie picture jedie  路  7Comments

WoLpH picture WoLpH  路  7Comments