Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change exit code to 2 when config file doesn't exist #1361

Merged
merged 1 commit into from
Apr 30, 2020
Merged

Change exit code to 2 when config file doesn't exist #1361

merged 1 commit into from
Apr 30, 2020

Conversation

tobywf
Copy link
Contributor

@tobywf tobywf commented Apr 24, 2020

Fixes #1360, where an invalid config file causes a return/exit code of 1. This change means this case is caught earlier, treated like any other bad parameters, and results in an exit code of 2.

Unit test fails before change is made:

======================================================================
FAIL: test_invalid_config_return_code (tests.test_black.BlackTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<snip>/black/tests/test_black.py", line 1654, in test_invalid_config_return_code
    self.invokeBlack(args, exit_code=2, ignore_config=False)
  File "<snip>/black/tests/test_black.py", line 162, in invokeBlack
    self.assertEqual(result.exit_code, exit_code, msg=runner.stderr_bytes.decode())
AssertionError: 1 != 2 : Error: Could not open file <snip>/blk_h9d894at.log: Error reading configuration file: [Errno 2] No such file or directory: '<snip>/blk_h9d894at.log'

Fixes #1360, where an invalid config file causes a return/exit code of 1. This
change means this case is caught earlier, treated like any other bad
parameters, and results in an exit code of 2.
@tobywf
Copy link
Contributor Author

tobywf commented Apr 29, 2020

Please let me know if there's anything you need from me to get this merged (did I forget a label or an assignee?). Would be nice to get it in before the refactor happens :)

@zsol zsol changed the title Require config file to exist Change exit code to 2 when config file doesn't exist Apr 30, 2020
@zsol zsol merged commit 7a14a37 into psf:master Apr 30, 2020
@zsol
Copy link
Collaborator

zsol commented Apr 30, 2020

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Black --check returns 1 when invalid config file is specified
3 participants