File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -51,10 +51,12 @@ def _error(msg):
5151 if exe is None :
5252 _error ('not found' )
5353 return exe
54- elif not os .access (orig , os .X_OK ):
55- _error ('not found' )
5654 elif os .path .isdir (orig ):
5755 _error ('is a directory' )
56+ elif not os .path .isfile (orig ):
57+ _error ('not found' )
58+ elif not os .access (orig , os .X_OK ): # pragma: windows no cover
59+ _error ('is not executable' )
5860 else :
5961 return orig
6062
Original file line number Diff line number Diff line change @@ -91,6 +91,14 @@ def test_normexe_does_not_exist_sep():
9191 assert excinfo .value .args == ('Executable `./i-dont-exist-lol` not found' ,)
9292
9393
94+ @pytest .mark .xfail (os .name == 'nt' , reason = 'posix only' ,)
95+ def test_normexe_not_executable (tmpdir ): # pragma: windows no cover
96+ tmpdir .join ('exe' ).ensure ()
97+ with tmpdir .as_cwd (), pytest .raises (OSError ) as excinfo :
98+ parse_shebang .normexe ('./exe' )
99+ assert excinfo .value .args == ('Executable `./exe` is not executable' ,)
100+
101+
94102def test_normexe_is_a_directory (tmpdir ):
95103 with tmpdir .as_cwd ():
96104 tmpdir .join ('exe' ).ensure_dir ()
You can’t perform that action at this time.
0 commit comments