File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -496,11 +496,13 @@ def run(
496496 command = tuple (_path_resolve (part ) for part in command )
497497 if win32resolve and sys .platform == "win32" :
498498 command = _windows_resolve (command )
499+ if working_directory and sys .version_info < (3 , 7 ):
500+ working_directory = os .fspath (working_directory )
499501
500502 p = subprocess .Popen (
501503 command ,
502504 shell = False ,
503- cwd = _path_resolve ( working_directory ) ,
505+ cwd = working_directory ,
504506 env = env ,
505507 stdin = stdin_pipe ,
506508 stdout = subprocess .PIPE ,
Original file line number Diff line number Diff line change 11import copy
22import mock
33import os
4+ import pathlib
45import procrunner
56import pytest
67import sys
@@ -87,13 +88,16 @@ def streamreader_processing(*args, **kwargs):
8788 False ,
8889 callback_stdout = mock .sentinel .callback_stdout ,
8990 callback_stderr = mock .sentinel .callback_stderr ,
90- working_directory = mock . sentinel . cwd ,
91+ working_directory = pathlib . Path ( "somecwd" ) ,
9192 raise_timeout_exception = True ,
9293 )
9394
9495 assert mock_subprocess .Popen .called
9596 assert mock_subprocess .Popen .call_args [1 ]["env" ] == os .environ
96- assert mock_subprocess .Popen .call_args [1 ]["cwd" ] == mock .sentinel .cwd
97+ assert mock_subprocess .Popen .call_args [1 ]["cwd" ] in (
98+ pathlib .Path ("somecwd" ),
99+ "somecwd" ,
100+ )
97101 mock_streamreader .assert_has_calls (
98102 [
99103 mock .call (
You can’t perform that action at this time.
0 commit comments