Merge branch '6.x-maintenance'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parents 0ad05de, 15977f2 · Browse files · 3 files·+38 added−20 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+38 added−20 removed
- tests:+11 added−0 removed
- other:+27 added−20 removed
Provenance
- Commit
d40fc8c- Tree
168af40- Author
Markus Unterwaditzer <markus@unterwaditzer.net>- Committer
Markus Unterwaditzer <markus@unterwaditzer.net>- Parent 1
0ad05de- Parent 2
15977f2
3 files changed+38 added−20 removed
modified:click/types.py+20 added-20 removed
418 unmodified lines419 self.path_type,420 filename_to_ui(value)421 ), param, ctx)422 423- if not self.file_okay and stat.S_ISREG(st.st_mode):424- self.fail('%s "%s" is a file.' % (425- self.path_type,426- filename_to_ui(value)427- ), param, ctx)428- if not self.dir_okay and stat.S_ISDIR(st.st_mode):429- self.fail('%s "%s" is a directory.' % (430- self.path_type,431- filename_to_ui(value)432- ), param, ctx)433- if self.writable and not os.access(value, os.W_OK):434- self.fail('%s "%s" is not writable.' % (435- self.path_type,436- filename_to_ui(value)437- ), param, ctx)438- if self.readable and not os.access(value, os.R_OK):439- self.fail('%s "%s" is not readable.' % (440- self.path_type,441- filename_to_ui(value)442- ), param, ctx)423+ if not self.file_okay and stat.S_ISREG(st.st_mode):424+ self.fail('%s "%s" is a file.' % (425+ self.path_type,426+ filename_to_ui(value)427+ ), param, ctx)428+ if not self.dir_okay and stat.S_ISDIR(st.st_mode):429+ self.fail('%s "%s" is a directory.' % (430+ self.path_type,431+ filename_to_ui(value)432+ ), param, ctx)433+ if self.writable and not os.access(value, os.W_OK):434+ self.fail('%s "%s" is not writable.' % (435+ self.path_type,436+ filename_to_ui(value)437+ ), param, ctx)438+ if self.readable and not os.access(value, os.R_OK):439+ self.fail('%s "%s" is not readable.' % (440+ self.path_type,441+ filename_to_ui(value)442+ ), param, ctx)443 444 return self.coerce_path_result(rv)445 446 106 unmodified linesmodified:tests/test_arguments.py+11 added
104 unmodified lines105 assert result.output == 'Hey!'106 assert result.exit_code == 0107 108 109+def test_path_args(runner):110+ @click.command()111+ @click.argument('input', type=click.Path(dir_okay=False, allow_dash=True))112+ def foo(input):113+ click.echo(input)114+115+ result = runner.invoke(foo, ['-'])116+ assert result.output == '-\n'117+ assert result.exit_code == 0118+119+120 def test_file_atomics(runner):121 @click.command()122 @click.argument('output', type=click.File('wb', atomic=True))123 def inout(output):166 unmodified linesmodified:CHANGES+7 added
9 unmodified lines10 11 - The exception objects now store unicode properly.12 - Added the ability to hide commands and options from help.13 14+Version 6.515+-----------16+17+(bugfix release; not yet released)18+19+- Fix bug in `click.Path` where it would crash when passed a `-`. See #551.20+21 Version 6.422 -----------23 24 (bugfix release; released on March 24th 2016)323 unmodified lines