nvim-neotest / neotest-python

MIT License
137 stars 40 forks source link

Added duplicate --failfast check #84

Closed Nealium closed 1 month ago

Nealium commented 2 months ago

--failfast was somewhat recently added to DiscoverRunner: https://github.com/django/django/commit/0a560eab550696dbc163d57258ef6f3cdb9511a3

Neotest trying to add it as well raises this error:

....
  File "/home/neal/.local/share/nvim/lazy/neotest-python/neotest_python/django_unittest.py", line 125, in run
    DjangoUnittestRunner.add_arguments(parser)
  File "/home/neal/.local/share/nvim/lazy/neotest-python/neotest_python/django_unittest.py", line 73, in add_arguments
    parser.add_argument(
  File "/usr/local/lib/python3.12/argparse.py", line 1490, in add_argument
    return self._add_action(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^
....
argparse.ArgumentError: argument --failfast: conflicting option string: --failfast

I've added a simple check to see if the argument is already in the namespace.

Tested with:

rcarriga commented 1 month ago

Thanks for the PR :smile: