You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When updating git in openSUSE to 2.38 the test suite failed with this package (build from the commit f653af6):
[ 49s] =================================== FAILURES ===================================
[ 49s] _________ TestSubmodule.test_git_submodules_and_add_sm_with_new_commit _________
[ 49s]
[ 49s] self = <test.test_submodule.TestSubmodule testMethod=test_git_submodules_and_add_sm_with_new_commit>
[ 49s] rwdir = '/tmp/test_git_submodules_and_add_sm_with_new_commitbgogzrvo'
[ 49s]
[ 49s] @skipIf(HIDE_WINDOWS_KNOWN_ERRORS,
[ 49s] """FIXME on cygwin: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute
[ 49s] raise GitCommandError(command, status, stderr_value, stdout_value)
[ 49s] GitCommandError: Cmd('git') failed due to: exit code(128)
[ 49s] cmdline: git add 1__Xava verbXXten 1_test _myfile 1_test_other_file 1_XXava-----verbXXten
[ 49s] stderr: 'fatal: pathspec '"1__çava verböten"' did not match any files'
[ 49s] FIXME on appveyor: see https://ci.appveyor.com/project/Byron/gitpython/build/1.0.185
[ 49s] """)
[ 49s] @with_rw_directory
[ 49s] def test_git_submodules_and_add_sm_with_new_commit(self, rwdir):
[ 49s] parent = git.Repo.init(osp.join(rwdir, 'parent'))
[ 49s] > parent.git.submodule('add', self._small_repo_url(), 'module')
[ 49s]
[ 49s] test/test_submodule.py:693:
[ 49s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 49s] git/cmd.py:542: in <lambda>
[ 49s] return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
[ 49s] git/cmd.py:1006: in _call_process
[ 49s] return self.execute(call, **exec_kwargs)
[ 49s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 49s]
[ 49s] self = <git.cmd.Git object at 0x7f79ea53a520>
[ 49s] command = ['/usr/bin/git', 'submodule', 'add', '/home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/git/ext/gitdb/gitdb/ext/smmap', 'module']
[ 49s] istream = None, with_extended_output = False, with_exceptions = True
[ 49s] as_process = False, output_stream = None, stdout_as_string = True
[ 49s] kill_after_timeout = None, with_stdout = True, universal_newlines = False
[ 49s] shell = None
[ 49s] env = {'CPU': 'x86_64', 'CSHEDIT': 'emacs', 'FORCE_SOURCE_DATE': '1', 'GIT_PYTHON_TEST_GIT_REPO_BASE': '/home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66', ...}
[ 49s] max_chunk_size = 8192, subprocess_kwargs = {}
[ 49s] cwd = '/tmp/test_git_submodules_and_add_sm_with_new_commitbgogzrvo/parent'
[ 49s] inline_env = None, cmd_not_found_exception = <class 'FileNotFoundError'>
[ 49s] stdout_sink = -1, istream_ok = 'None'
[ 49s] proc = <subprocess.Popen object at 0x7f79ea0e6220>
[ 49s]
[ 49s] def execute(self, command,
[ 49s] istream=None,
[ 49s] with_extended_output=False,
[ 49s] with_exceptions=True,
[ 49s] as_process=False,
[ 49s] output_stream=None,
[ 49s] stdout_as_string=True,
[ 49s] kill_after_timeout=None,
[ 49s] with_stdout=True,
[ 49s] universal_newlines=False,
[ 49s] shell=None,
[ 49s] env=None,
[ 49s] max_chunk_size=io.DEFAULT_BUFFER_SIZE,
[ 49s] **subprocess_kwargs
[ 49s] ):
[ 49s] """Handles executing the command on the shell and consumes and returns
[ 49s] the returned information (stdout)
[ 49s]
[ 49s] :param command:
[ 49s] The command argument list to execute.
[ 49s] It should be a string, or a sequence of program arguments. The
[ 49s] program to execute is the first item in the args sequence or string.
[ 49s]
[ 49s] :param istream:
[ 49s] Standard input filehandle passed to subprocess.Popen.
[ 49s]
[ 49s] :param with_extended_output:
[ 49s] Whether to return a (status, stdout, stderr) tuple.
[ 49s]
[ 49s] :param with_exceptions:
[ 49s] Whether to raise an exception when git returns a non-zero status.
[ 49s]
[ 49s] :param as_process:
[ 49s] Whether to return the created process instance directly from which
[ 49s] streams can be read on demand. This will render with_extended_output and
[ 49s] with_exceptions ineffective - the caller will have
[ 49s] to deal with the details himself.
[ 49s] It is important to note that the process will be placed into an AutoInterrupt
[ 49s] wrapper that will interrupt the process once it goes out of scope. If you
[ 49s] use the command in iterators, you should pass the whole process instance
[ 49s] instead of a single stream.
[ 49s]
[ 49s] :param output_stream:
[ 49s] If set to a file-like object, data produced by the git command will be
[ 49s] output to the given stream directly.
[ 49s] This feature only has any effect if as_process is False. Processes will
[ 49s] always be created with a pipe due to issues with subprocess.
[ 49s] This merely is a workaround as data will be copied from the
[ 49s] output pipe to the given output stream directly.
[ 49s] Judging from the implementation, you shouldn't use this flag !
[ 49s]
[ 49s] :param stdout_as_string:
[ 49s] if False, the commands standard output will be bytes. Otherwise, it will be
[ 49s] decoded into a string using the default encoding (usually utf-8).
[ 49s] The latter can fail, if the output contains binary data.
[ 49s]
[ 49s] :param env:
[ 49s] A dictionary of environment variables to be passed to `subprocess.Popen`.
[ 49s]
[ 49s] :param max_chunk_size:
[ 49s] Maximum number of bytes in one chunk of data passed to the output_stream in
[ 49s] one invocation of write() method. If the given number is not positive then
[ 49s] the default value is used.
[ 49s]
[ 49s] :param subprocess_kwargs:
[ 49s] Keyword arguments to be passed to subprocess.Popen. Please note that
[ 49s] some of the valid kwargs are already set by this method, the ones you
[ 49s] specify may not be the same ones.
[ 49s]
[ 49s] :param with_stdout: If True, default True, we open stdout on the created process
[ 49s] :param universal_newlines:
[ 49s] if True, pipes will be opened as text, and lines are split at
[ 49s] all known line endings.
[ 49s] :param shell:
[ 49s] Whether to invoke commands through a shell (see `Popen(..., shell=True)`).
[ 49s] It overrides :attr:`USE_SHELL` if it is not `None`.
[ 49s] :param kill_after_timeout:
[ 49s] To specify a timeout in seconds for the git command, after which the process
[ 49s] should be killed. This will have no effect if as_process is set to True. It is
[ 49s] set to None by default and will let the process run until the timeout is
[ 49s] explicitly specified. This feature is not supported on Windows. It's also worth
[ 49s] noting that kill_after_timeout uses SIGKILL, which can have negative side
[ 49s] effects on a repository. For example, stale locks in case of git gc could
[ 49s] render the repository incapable of accepting changes until the lock is manually
[ 49s] removed.
[ 49s]
[ 49s] :return:
[ 49s] * str(output) if extended_output = False (Default)
[ 49s] * tuple(int(status), str(stdout), str(stderr)) if extended_output = True
[ 49s]
[ 49s] if output_stream is True, the stdout value will be your output stream:
[ 49s] * output_stream if extended_output = False
[ 49s] * tuple(int(status), output_stream, str(stderr)) if extended_output = True
[ 49s]
[ 49s] Note git is executed with LC_MESSAGES="C" to ensure consistent
[ 49s] output regardless of system language.
[ 49s]
[ 49s] :raise GitCommandError:
[ 49s]
[ 49s] :note:
[ 49s] If you add additional keyword arguments to the signature of this method,
[ 49s] you must update the execute_kwargs tuple housed in this module."""
[ 49s] if self.GIT_PYTHON_TRACE and (self.GIT_PYTHON_TRACE != 'full' or as_process):
[ 49s] log.info(' '.join(command))
[ 49s]
[ 49s] # Allow the user to have the command executed in their working dir.
[ 49s] cwd = self._working_dir or os.getcwd()
[ 49s]
[ 49s] # Start the process
[ 49s] inline_env = env
[ 49s] env = os.environ.copy()
[ 49s] # Attempt to force all output to plain ascii english, which is what some parsing code
[ 49s] # may expect.
[ 49s] # According to stackoverflow (http://goo.gl/l74GC8), we are setting LANGUAGE as well
[ 49s] # just to be sure.
[ 49s] env["LANGUAGE"] = "C"
[ 49s] env["LC_ALL"] = "C"
[ 49s] env.update(self._environment)
[ 49s] if inline_env is not None:
[ 49s] env.update(inline_env)
[ 49s]
[ 49s] if is_win:
[ 49s] cmd_not_found_exception = OSError
[ 49s] if kill_after_timeout:
[ 49s] raise GitCommandError(command, '"kill_after_timeout" feature is not supported on Windows.')
[ 49s] else:
[ 49s] if sys.version_info[0] > 2:
[ 49s] cmd_not_found_exception = FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable
[ 49s] else:
[ 49s] cmd_not_found_exception = OSError
[ 49s] # end handle
[ 49s]
[ 49s] stdout_sink = (PIPE
[ 49s] if with_stdout
[ 49s] else getattr(subprocess, 'DEVNULL', None) or open(os.devnull, 'wb'))
[ 49s] istream_ok = "None"
[ 49s] if istream:
[ 49s] istream_ok = "<valid stream>"
[ 49s] log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)",
[ 49s] command, cwd, universal_newlines, shell, istream_ok)
[ 49s] try:
[ 49s] proc = Popen(command,
[ 49s] env=env,
[ 49s] cwd=cwd,
[ 49s] bufsize=-1,
[ 49s] stdin=istream,
[ 49s] stderr=PIPE,
[ 49s] stdout=stdout_sink,
[ 49s] shell=shell is not None and shell or self.USE_SHELL,
[ 49s] close_fds=is_posix, # unsupported on windows
[ 49s] universal_newlines=universal_newlines,
[ 49s] creationflags=PROC_CREATIONFLAGS,
[ 49s] **subprocess_kwargs
[ 49s] )
[ 49s] except cmd_not_found_exception as err:
[ 49s] raise GitCommandNotFound(command, err) from err
[ 49s]
[ 49s] if as_process:
[ 49s] return self.AutoInterrupt(proc, command)
[ 49s]
[ 49s] def _kill_process(pid):
[ 49s] """ Callback method to kill a process. """
[ 49s] p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE,
[ 49s] creationflags=PROC_CREATIONFLAGS)
[ 49s] child_pids = []
[ 49s] for line in p.stdout:
[ 49s] if len(line.split()) > 0:
[ 49s] local_pid = (line.split())[0]
[ 49s] if local_pid.isdigit():
[ 49s] child_pids.append(int(local_pid))
[ 49s] try:
[ 49s] # Windows does not have SIGKILL, so use SIGTERM instead
[ 49s] sig = getattr(signal, 'SIGKILL', signal.SIGTERM)
[ 49s] os.kill(pid, sig)
[ 49s] for child_pid in child_pids:
[ 49s] try:
[ 49s] os.kill(child_pid, sig)
[ 49s] except OSError:
[ 49s] pass
[ 49s] kill_check.set() # tell the main routine that the process was killed
[ 49s] except OSError:
[ 49s] # It is possible that the process gets completed in the duration after timeout
[ 49s] # happens and before we try to kill the process.
[ 49s] pass
[ 49s] return
[ 49s] # end
[ 49s]
[ 49s] if kill_after_timeout:
[ 49s] kill_check = threading.Event()
[ 49s] watchdog = threading.Timer(kill_after_timeout, _kill_process, args=(proc.pid,))
[ 49s]
[ 49s] # Wait for the process to return
[ 49s] status = 0
[ 49s] stdout_value = b''
[ 49s] stderr_value = b''
[ 49s] newline = "\n" if universal_newlines else b"\n"
[ 49s] try:
[ 49s] if output_stream is None:
[ 49s] if kill_after_timeout:
[ 49s] watchdog.start()
[ 49s] stdout_value, stderr_value = proc.communicate()
[ 49s] if kill_after_timeout:
[ 49s] watchdog.cancel()
[ 49s] if kill_check.isSet():
[ 49s] stderr_value = ('Timeout: the command "%s" did not complete in %d '
[ 49s] 'secs.' % (" ".join(command), kill_after_timeout)).encode(defenc)
[ 49s] # strip trailing "\n"
[ 49s] if stdout_value.endswith(newline):
[ 49s] stdout_value = stdout_value[:-1]
[ 49s] if stderr_value.endswith(newline):
[ 49s] stderr_value = stderr_value[:-1]
[ 49s] status = proc.returncode
[ 49s] else:
[ 49s] max_chunk_size = max_chunk_size if max_chunk_size and max_chunk_size > 0 else io.DEFAULT_BUFFER_SIZE
[ 49s] stream_copy(proc.stdout, output_stream, max_chunk_size)
[ 49s] stdout_value = proc.stdout.read()
[ 49s] stderr_value = proc.stderr.read()
[ 49s] # strip trailing "\n"
[ 49s] if stderr_value.endswith(newline):
[ 49s] stderr_value = stderr_value[:-1]
[ 49s] status = proc.wait()
[ 49s] # END stdout handling
[ 49s] finally:
[ 49s] proc.stdout.close()
[ 49s] proc.stderr.close()
[ 49s]
[ 49s] if self.GIT_PYTHON_TRACE == 'full':
[ 49s] cmdstr = " ".join(command)
[ 49s]
[ 49s] def as_text(stdout_value):
[ 49s] return not output_stream and safe_decode(stdout_value) or '<OUTPUT_STREAM>'
[ 49s] # end
[ 49s]
[ 49s] if stderr_value:
[ 49s] log.info("%s -> %d; stdout: '%s'; stderr: '%s'",
[ 49s] cmdstr, status, as_text(stdout_value), safe_decode(stderr_value))
[ 49s] elif stdout_value:
[ 49s] log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value))
[ 49s] else:
[ 49s] log.info("%s -> %d", cmdstr, status)
[ 49s] # END handle debug printing
[ 49s]
[ 49s] if with_exceptions and status != 0:
[ 49s] > raise GitCommandError(command, status, stderr_value, stdout_value)
[ 49s] E git.exc.GitCommandError: Cmd('/usr/bin/git') failed due to: exit code(128)
[ 49s] E cmdline: /usr/bin/git submodule add /home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/git/ext/gitdb/gitdb/ext/smmap module
[ 49s] E stderr: 'Cloning into '/tmp/test_git_submodules_and_add_sm_with_new_commitbgogzrvo/parent/module'...
[ 49s] E fatal: transport 'file' not allowed
[ 49s] E fatal: clone of '/home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/git/ext/gitdb/gitdb/ext/smmap' into submodule path '/tmp/test_git_submodules_and_add_sm_with_new_commitbgogzrvo/parent/module' failed'
[ 49s]
[ 49s] git/cmd.py:823: GitCommandError
[ 49s] ________________ TestSubmodule.test_list_only_valid_submodules _________________
[ 49s]
[ 49s] self = <test.test_submodule.TestSubmodule testMethod=test_list_only_valid_submodules>
[ 49s] rwdir = '/tmp/test_list_only_valid_submodulesgx2vdn49'
[ 49s]
[ 49s] @with_rw_directory
[ 49s] def test_list_only_valid_submodules(self, rwdir):
[ 49s] repo_path = osp.join(rwdir, 'parent')
[ 49s] repo = git.Repo.init(repo_path)
[ 49s] > repo.git.submodule('add', self._small_repo_url(), 'module')
[ 49s]
[ 49s] test/test_submodule.py:668:
[ 49s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 49s] git/cmd.py:542: in <lambda>
[ 49s] return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
[ 49s] git/cmd.py:1006: in _call_process
[ 49s] return self.execute(call, **exec_kwargs)
[ 49s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 49s]
[ 49s] self = <git.cmd.Git object at 0x7f79ea536c40>
[ 49s] command = ['/usr/bin/git', 'submodule', 'add', '/home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/git/ext/gitdb/gitdb/ext/smmap', 'module']
[ 49s] istream = None, with_extended_output = False, with_exceptions = True
[ 49s] as_process = False, output_stream = None, stdout_as_string = True
[ 49s] kill_after_timeout = None, with_stdout = True, universal_newlines = False
[ 49s] shell = None
[ 49s] env = {'CPU': 'x86_64', 'CSHEDIT': 'emacs', 'FORCE_SOURCE_DATE': '1', 'GIT_PYTHON_TEST_GIT_REPO_BASE': '/home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66', ...}
[ 49s] max_chunk_size = 8192, subprocess_kwargs = {}
[ 49s] cwd = '/tmp/test_list_only_valid_submodulesgx2vdn49/parent', inline_env = None
[ 49s] cmd_not_found_exception = <class 'FileNotFoundError'>, stdout_sink = -1
[ 49s] istream_ok = 'None', proc = <subprocess.Popen object at 0x7f79ea0ffdc0>
[ 49s]
[ 49s] def execute(self, command,
[ 49s] istream=None,
[ 49s] with_extended_output=False,
[ 49s] with_exceptions=True,
[ 49s] as_process=False,
[ 49s] output_stream=None,
[ 49s] stdout_as_string=True,
[ 49s] kill_after_timeout=None,
[ 49s] with_stdout=True,
[ 49s] universal_newlines=False,
[ 49s] shell=None,
[ 49s] env=None,
[ 49s] max_chunk_size=io.DEFAULT_BUFFER_SIZE,
[ 49s] **subprocess_kwargs
[ 49s] ):
[ 49s] """Handles executing the command on the shell and consumes and returns
[ 49s] the returned information (stdout)
[ 49s]
[ 49s] :param command:
[ 49s] The command argument list to execute.
[ 49s] It should be a string, or a sequence of program arguments. The
[ 49s] program to execute is the first item in the args sequence or string.
[ 49s]
[ 49s] :param istream:
[ 49s] Standard input filehandle passed to subprocess.Popen.
[ 49s]
[ 49s] :param with_extended_output:
[ 49s] Whether to return a (status, stdout, stderr) tuple.
[ 49s]
[ 49s] :param with_exceptions:
[ 49s] Whether to raise an exception when git returns a non-zero status.
[ 49s]
[ 49s] :param as_process:
[ 49s] Whether to return the created process instance directly from which
[ 49s] streams can be read on demand. This will render with_extended_output and
[ 49s] with_exceptions ineffective - the caller will have
[ 49s] to deal with the details himself.
[ 49s] It is important to note that the process will be placed into an AutoInterrupt
[ 49s] wrapper that will interrupt the process once it goes out of scope. If you
[ 49s] use the command in iterators, you should pass the whole process instance
[ 49s] instead of a single stream.
[ 49s]
[ 49s] :param output_stream:
[ 49s] If set to a file-like object, data produced by the git command will be
[ 49s] output to the given stream directly.
[ 49s] This feature only has any effect if as_process is False. Processes will
[ 49s] always be created with a pipe due to issues with subprocess.
[ 49s] This merely is a workaround as data will be copied from the
[ 49s] output pipe to the given output stream directly.
[ 49s] Judging from the implementation, you shouldn't use this flag !
[ 49s]
[ 49s] :param stdout_as_string:
[ 49s] if False, the commands standard output will be bytes. Otherwise, it will be
[ 49s] decoded into a string using the default encoding (usually utf-8).
[ 49s] The latter can fail, if the output contains binary data.
[ 49s]
[ 49s] :param env:
[ 49s] A dictionary of environment variables to be passed to `subprocess.Popen`.
[ 49s]
[ 49s] :param max_chunk_size:
[ 49s] Maximum number of bytes in one chunk of data passed to the output_stream in
[ 49s] one invocation of write() method. If the given number is not positive then
[ 49s] the default value is used.
[ 49s]
[ 49s] :param subprocess_kwargs:
[ 49s] Keyword arguments to be passed to subprocess.Popen. Please note that
[ 49s] some of the valid kwargs are already set by this method, the ones you
[ 49s] specify may not be the same ones.
[ 49s]
[ 49s] :param with_stdout: If True, default True, we open stdout on the created process
[ 49s] :param universal_newlines:
[ 49s] if True, pipes will be opened as text, and lines are split at
[ 49s] all known line endings.
[ 49s] :param shell:
[ 49s] Whether to invoke commands through a shell (see `Popen(..., shell=True)`).
[ 49s] It overrides :attr:`USE_SHELL` if it is not `None`.
[ 49s] :param kill_after_timeout:
[ 49s] To specify a timeout in seconds for the git command, after which the process
[ 49s] should be killed. This will have no effect if as_process is set to True. It is
[ 49s] set to None by default and will let the process run until the timeout is
[ 49s] explicitly specified. This feature is not supported on Windows. It's also worth
[ 49s] noting that kill_after_timeout uses SIGKILL, which can have negative side
[ 49s] effects on a repository. For example, stale locks in case of git gc could
[ 49s] render the repository incapable of accepting changes until the lock is manually
[ 49s] removed.
[ 49s]
[ 49s] :return:
[ 49s] * str(output) if extended_output = False (Default)
[ 49s] * tuple(int(status), str(stdout), str(stderr)) if extended_output = True
[ 49s]
[ 49s] if output_stream is True, the stdout value will be your output stream:
[ 49s] * output_stream if extended_output = False
[ 49s] * tuple(int(status), output_stream, str(stderr)) if extended_output = True
[ 49s]
[ 49s] Note git is executed with LC_MESSAGES="C" to ensure consistent
[ 49s] output regardless of system language.
[ 49s]
[ 49s] :raise GitCommandError:
[ 49s]
[ 49s] :note:
[ 49s] If you add additional keyword arguments to the signature of this method,
[ 49s] you must update the execute_kwargs tuple housed in this module."""
[ 49s] if self.GIT_PYTHON_TRACE and (self.GIT_PYTHON_TRACE != 'full' or as_process):
[ 49s] log.info(' '.join(command))
[ 49s]
[ 49s] # Allow the user to have the command executed in their working dir.
[ 49s] cwd = self._working_dir or os.getcwd()
[ 49s]
[ 49s] # Start the process
[ 49s] inline_env = env
[ 49s] env = os.environ.copy()
[ 49s] # Attempt to force all output to plain ascii english, which is what some parsing code
[ 49s] # may expect.
[ 49s] # According to stackoverflow (http://goo.gl/l74GC8), we are setting LANGUAGE as well
[ 49s] # just to be sure.
[ 49s] env["LANGUAGE"] = "C"
[ 49s] env["LC_ALL"] = "C"
[ 49s] env.update(self._environment)
[ 49s] if inline_env is not None:
[ 49s] env.update(inline_env)
[ 49s]
[ 49s] if is_win:
[ 49s] cmd_not_found_exception = OSError
[ 49s] if kill_after_timeout:
[ 49s] raise GitCommandError(command, '"kill_after_timeout" feature is not supported on Windows.')
[ 49s] else:
[ 49s] if sys.version_info[0] > 2:
[ 49s] cmd_not_found_exception = FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable
[ 49s] else:
[ 49s] cmd_not_found_exception = OSError
[ 49s] # end handle
[ 49s]
[ 49s] stdout_sink = (PIPE
[ 49s] if with_stdout
[ 49s] else getattr(subprocess, 'DEVNULL', None) or open(os.devnull, 'wb'))
[ 49s] istream_ok = "None"
[ 49s] if istream:
[ 49s] istream_ok = "<valid stream>"
[ 49s] log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)",
[ 49s] command, cwd, universal_newlines, shell, istream_ok)
[ 49s] try:
[ 49s] proc = Popen(command,
[ 49s] env=env,
[ 49s] cwd=cwd,
[ 49s] bufsize=-1,
[ 49s] stdin=istream,
[ 49s] stderr=PIPE,
[ 49s] stdout=stdout_sink,
[ 49s] shell=shell is not None and shell or self.USE_SHELL,
[ 49s] close_fds=is_posix, # unsupported on windows
[ 49s] universal_newlines=universal_newlines,
[ 49s] creationflags=PROC_CREATIONFLAGS,
[ 49s] **subprocess_kwargs
[ 49s] )
[ 49s] except cmd_not_found_exception as err:
[ 49s] raise GitCommandNotFound(command, err) from err
[ 49s]
[ 49s] if as_process:
[ 49s] return self.AutoInterrupt(proc, command)
[ 49s]
[ 49s] def _kill_process(pid):
[ 49s] """ Callback method to kill a process. """
[ 49s] p = Popen(['ps', '--ppid', str(pid)], stdout=PIPE,
[ 49s] creationflags=PROC_CREATIONFLAGS)
[ 49s] child_pids = []
[ 49s] for line in p.stdout:
[ 49s] if len(line.split()) > 0:
[ 49s] local_pid = (line.split())[0]
[ 49s] if local_pid.isdigit():
[ 49s] child_pids.append(int(local_pid))
[ 49s] try:
[ 49s] # Windows does not have SIGKILL, so use SIGTERM instead
[ 49s] sig = getattr(signal, 'SIGKILL', signal.SIGTERM)
[ 49s] os.kill(pid, sig)
[ 49s] for child_pid in child_pids:
[ 49s] try:
[ 49s] os.kill(child_pid, sig)
[ 49s] except OSError:
[ 49s] pass
[ 49s] kill_check.set() # tell the main routine that the process was killed
[ 49s] except OSError:
[ 49s] # It is possible that the process gets completed in the duration after timeout
[ 49s] # happens and before we try to kill the process.
[ 49s] pass
[ 49s] return
[ 49s] # end
[ 49s]
[ 49s] if kill_after_timeout:
[ 49s] kill_check = threading.Event()
[ 49s] watchdog = threading.Timer(kill_after_timeout, _kill_process, args=(proc.pid,))
[ 49s]
[ 49s] # Wait for the process to return
[ 49s] status = 0
[ 49s] stdout_value = b''
[ 49s] stderr_value = b''
[ 49s] newline = "\n" if universal_newlines else b"\n"
[ 49s] try:
[ 49s] if output_stream is None:
[ 49s] if kill_after_timeout:
[ 49s] watchdog.start()
[ 49s] stdout_value, stderr_value = proc.communicate()
[ 49s] if kill_after_timeout:
[ 49s] watchdog.cancel()
[ 49s] if kill_check.isSet():
[ 49s] stderr_value = ('Timeout: the command "%s" did not complete in %d '
[ 49s] 'secs.' % (" ".join(command), kill_after_timeout)).encode(defenc)
[ 49s] # strip trailing "\n"
[ 49s] if stdout_value.endswith(newline):
[ 49s] stdout_value = stdout_value[:-1]
[ 49s] if stderr_value.endswith(newline):
[ 49s] stderr_value = stderr_value[:-1]
[ 49s] status = proc.returncode
[ 49s] else:
[ 49s] max_chunk_size = max_chunk_size if max_chunk_size and max_chunk_size > 0 else io.DEFAULT_BUFFER_SIZE
[ 49s] stream_copy(proc.stdout, output_stream, max_chunk_size)
[ 49s] stdout_value = proc.stdout.read()
[ 49s] stderr_value = proc.stderr.read()
[ 49s] # strip trailing "\n"
[ 49s] if stderr_value.endswith(newline):
[ 49s] stderr_value = stderr_value[:-1]
[ 49s] status = proc.wait()
[ 49s] # END stdout handling
[ 49s] finally:
[ 49s] proc.stdout.close()
[ 49s] proc.stderr.close()
[ 49s]
[ 49s] if self.GIT_PYTHON_TRACE == 'full':
[ 49s] cmdstr = " ".join(command)
[ 49s]
[ 49s] def as_text(stdout_value):
[ 49s] return not output_stream and safe_decode(stdout_value) or '<OUTPUT_STREAM>'
[ 49s] # end
[ 49s]
[ 49s] if stderr_value:
[ 49s] log.info("%s -> %d; stdout: '%s'; stderr: '%s'",
[ 49s] cmdstr, status, as_text(stdout_value), safe_decode(stderr_value))
[ 49s] elif stdout_value:
[ 49s] log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value))
[ 49s] else:
[ 49s] log.info("%s -> %d", cmdstr, status)
[ 49s] # END handle debug printing
[ 49s]
[ 49s] if with_exceptions and status != 0:
[ 49s] > raise GitCommandError(command, status, stderr_value, stdout_value)
[ 49s] E git.exc.GitCommandError: Cmd('/usr/bin/git') failed due to: exit code(128)
[ 49s] E cmdline: /usr/bin/git submodule add /home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/git/ext/gitdb/gitdb/ext/smmap module
[ 49s] E stderr: 'Cloning into '/tmp/test_list_only_valid_submodulesgx2vdn49/parent/module'...
[ 49s] E fatal: transport 'file' not allowed
[ 49s] E fatal: clone of '/home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/git/ext/gitdb/gitdb/ext/smmap' into submodule path '/tmp/test_list_only_valid_submodulesgx2vdn49/parent/module' failed'
[ 49s]
[ 49s] git/cmd.py:823: GitCommandError
[ 49s] =============================== warnings summary ===============================
[ 49s] test/test_remote.py:41
[ 49s] /home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/test/test_remote.py:41: PytestCollectionWarning: cannot collect test class 'TestRemoteProgress' because it has a __init__ constructor (from: test/test_remote.py)
[ 49s] class TestRemoteProgress(RemoteProgress):
[ 49s]
[ 49s] test/test_submodule.py:32
[ 49s] /home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/test/test_submodule.py:32: PytestCollectionWarning: cannot collect test class 'TestRootProgress' because it has a __init__ constructor (from: test/test_submodule.py)
[ 49s] class TestRootProgress(RootUpdateProgress):
[ 49s]
[ 49s] test/test_util.py:64
[ 49s] /home/abuild/rpmbuild/BUILD/GitPython-3.1.12.1610074031.f653af66/test/test_util.py:64: PytestCollectionWarning: cannot collect test class 'TestIterableMember' because it has a __init__ constructor (from: test/test_util.py)
[ 49s] class TestIterableMember(object):
[ 49s]
[ 49s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[ 49s] =========================== short test summary info ============================
[ 49s] FAILED test/test_submodule.py::TestSubmodule::test_git_submodules_and_add_sm_with_new_commit
[ 49s] FAILED test/test_submodule.py::TestSubmodule::test_list_only_valid_submodules
[ 49s] ===== 2 failed, 356 passed, 47 skipped, 1 deselected, 3 warnings in 40.12s =====
See complete build log for versions of all packages used and steps taken to reproduce.
The text was updated successfully, but these errors were encountered:
One now has to set protocol.file.allow=always for tests to work as before.
I don't know if this could effectively be set for the whole process before the tests run? In gitoxide I do it using the GIT_CONFIG_COUNT|*KEY|*VALUE environment variables.
When updating git in openSUSE to 2.38 the test suite failed with this package (build from the commit f653af6):
See complete build log for versions of all packages used and steps taken to reproduce.
The text was updated successfully, but these errors were encountered: