Skip to content

Conversation

@moe-ad
Copy link
Contributor

@moe-ad moe-ad commented Oct 13, 2025

Closes #2676.

@moe-ad moe-ad self-assigned this Oct 13, 2025
@codecov
Copy link

codecov bot commented Oct 13, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
2058 2 2056 95
View the top 3 failed test(s) by shortest run time
test_workflow\test_workflow.py::test_workflow::test_workflow_view
Stack Traces | 1.42s run time
cmd = [WindowsPath('dot'), '-Kdot', '-Tpng', '-o', 'test1.png', 'test1.dot']
input_lines = None, encoding = None, quiet = False
kwargs = {'capture_output': True, 'cwd': WindowsPath('D:....../a/pydpf-core/pydpf-core'), 'startupinfo': <subprocess.STARTUPINFO object at 0x0000018C9115DF60>}

    def run_check(cmd: typing.Sequence[typing.Union[os.PathLike, str]], *,
                  input_lines: typing.Optional[BytesOrStrIterator] = None,
                  encoding: typing.Optional[str] = None,
                  quiet: bool = False,
                  **kwargs) -> subprocess.CompletedProcess:
        """Run the command described by ``cmd``
            with ``check=True`` and return its completed process.
    
        Raises:
            CalledProcessError: if the returncode of the subprocess is non-zero.
        """
        log.debug('run %r', cmd)
        if not kwargs.pop('check', True):  # pragma: no cover
            raise NotImplementedError('check must be True or omited')
    
        if encoding is not None:
            kwargs['encoding'] = encoding
    
        kwargs.setdefault('startupinfo', _compat.get_startupinfo())
    
        try:
            if input_lines is not None:
                assert kwargs.get('input') is None
                assert iter(input_lines) is input_lines
                if kwargs.pop('capture_output'):
                    kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE
                proc = _run_input_lines(cmd, input_lines, kwargs=kwargs)
            else:
>               proc = subprocess.run(cmd, **kwargs)

.tox\test-workflow\lib\site-packages\graphviz\backend\execute.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\subprocess.py:503: in run
    with Popen(*popenargs, **kwargs) as process:
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\subprocess.py:971: in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Popen: returncode: None args: [WindowsPath('dot'), '-Kdot', '-Tpng', '-o', ...>
args = 'dot -Kdot -Tpng -o test1.png test1.dot', executable = None
preexec_fn = None, close_fds = False, pass_fds = ()
cwd = 'D:\\a\\pydpf-core\\pydpf-core', env = None
startupinfo = <subprocess.STARTUPINFO object at 0x0000018C9115E4A0>
creationflags = 0, shell = False, p2cread = Handle(1816), p2cwrite = -1
c2pread = 8, c2pwrite = Handle(1680), errread = 9, errwrite = Handle(1592)
unused_restore_signals = True, unused_gid = None, unused_gids = None
unused_uid = None, unused_umask = -1, unused_start_new_session = False

    def _execute_child(self, args, executable, preexec_fn, close_fds,
                       pass_fds, cwd, env,
                       startupinfo, creationflags, shell,
                       p2cread, p2cwrite,
                       c2pread, c2pwrite,
                       errread, errwrite,
                       unused_restore_signals,
                       unused_gid, unused_gids, unused_uid,
                       unused_umask,
                       unused_start_new_session):
        """Execute program (MS Windows version)"""
    
        assert not pass_fds, "pass_fds not supported on Windows."
    
        if isinstance(args, str):
            pass
        elif isinstance(args, bytes):
            if shell:
                raise TypeError('bytes args is not allowed on Windows')
            args = list2cmdline([args])
        elif isinstance(args, os.PathLike):
            if shell:
                raise TypeError('path-like args is not allowed when '
                                'shell is true')
            args = list2cmdline([args])
        else:
            args = list2cmdline(args)
    
        if executable is not None:
            executable = os.fsdecode(executable)
    
        # Process startup details
        if startupinfo is None:
            startupinfo = STARTUPINFO()
        else:
            # bpo-34044: Copy STARTUPINFO since it is modified above,
            # so the caller can reuse it multiple times.
            startupinfo = startupinfo.copy()
    
        use_std_handles = -1 not in (p2cread, c2pwrite, errwrite)
        if use_std_handles:
            startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
            startupinfo.hStdInput = p2cread
            startupinfo.hStdOutput = c2pwrite
            startupinfo.hStdError = errwrite
    
        attribute_list = startupinfo.lpAttributeList
        have_handle_list = bool(attribute_list and
                                "handle_list" in attribute_list and
                                attribute_list["handle_list"])
    
        # If we were given an handle_list or need to create one
        if have_handle_list or (use_std_handles and close_fds):
            if attribute_list is None:
                attribute_list = startupinfo.lpAttributeList = {}
            handle_list = attribute_list["handle_list"] = \
                list(attribute_list.get("handle_list", []))
    
            if use_std_handles:
                handle_list += [int(p2cread), int(c2pwrite), int(errwrite)]
    
            handle_list[:] = self._filter_handle_list(handle_list)
    
            if handle_list:
                if not close_fds:
                    warnings.warn("startupinfo.lpAttributeList['handle_list'] "
                                  "overriding close_fds", RuntimeWarning)
    
                # When using the handle_list we always request to inherit
                # handles but the only handles that will be inherited are
                # the ones in the handle_list
                close_fds = False
    
        if shell:
            startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
            startupinfo.wShowWindow = _winapi.SW_HIDE
            if not executable:
                # gh-101283: without a fully-qualified path, before Windows
                # checks the system directories, it first looks in the
                # application directory, and also the current directory if
                # NeedCurrentDirectoryForExePathW(ExeName) is true, so try
                # to avoid executing unqualified "cmd.exe".
                comspec = os.environ.get('ComSpec')
                if not comspec:
                    system_root = os.environ.get('SystemRoot', '')
                    comspec = os.path.join(system_root, 'System32', 'cmd.exe')
                    if not os.path.isabs(comspec):
                        raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
                if os.path.isabs(comspec):
                    executable = comspec
            else:
                comspec = executable
    
            args = '{} /c "{}"'.format (comspec, args)
    
        if cwd is not None:
            cwd = os.fsdecode(cwd)
    
        sys.audit("subprocess.Popen", executable, args, cwd, env)
    
        # Start the process
        try:
>           hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                                     # no special security
                                     None, None,
                                     int(not close_fds),
                                     creationflags,
                                     env,
                                     cwd,
                                     startupinfo)
E                                    FileNotFoundError: [WinError 2] The system cannot find the file specified

C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\subprocess.py:1456: FileNotFoundError

The above exception was the direct cause of the following exception:

server_in_process = <ansys.dpf.core.server_types.InProcessServer object at 0x0000018C90019B10>
remove_dot_file = None

    @pytest.mark.skipif(not HAS_GRAPHVIZ, reason="Please install graphviz")
    def test_workflow_view(server_in_process, remove_dot_file):
        pre_wf = dpf.core.Workflow(server=server_in_process)
        pre_op = dpf.core.operators.utility.forward(server=server_in_process)
        pre_wf.add_operator(pre_op)
        pre_wf.set_input_name("prewf_input", pre_op.inputs.any)
        pre_wf.set_output_name("prewf_output", pre_op.outputs.any)
    
        wf = dpf.core.Workflow(server=server_in_process)
        forward_op = dpf.core.operators.utility.forward(server=server_in_process)
        wf.add_operator(forward_op)
        wf.set_input_name("wf_input", forward_op.inputs.any)
        wf.set_output_name("wf_output", forward_op.outputs.any)
    
        wf.connect_with(pre_wf, {"prewf_output": "wf_input"})
>       wf.view(off_screen=True, title="test1")

test_workflow\test_workflow.py:81: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\test-workflow\lib\site-packages\ansys\dpf\core\workflow.py:974: in view
    graphviz.render(engine="dot", filepath=dot_path, outfile=image_path)
.tox\test-workflow\lib\site-packages\graphviz\_tools.py:185: in wrapper
    return func(*args, **kwargs)
.tox\test-workflow\lib\site-packages\graphviz\backend\rendering.py:326: in render
    execute.run_check(cmd,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = [WindowsPath('dot'), '-Kdot', '-Tpng', '-o', 'test1.png', 'test1.dot']
input_lines = None, encoding = None, quiet = False
kwargs = {'capture_output': True, 'cwd': WindowsPath('D:....../a/pydpf-core/pydpf-core'), 'startupinfo': <subprocess.STARTUPINFO object at 0x0000018C9115DF60>}

    def run_check(cmd: typing.Sequence[typing.Union[os.PathLike, str]], *,
                  input_lines: typing.Optional[BytesOrStrIterator] = None,
                  encoding: typing.Optional[str] = None,
                  quiet: bool = False,
                  **kwargs) -> subprocess.CompletedProcess:
        """Run the command described by ``cmd``
            with ``check=True`` and return its completed process.
    
        Raises:
            CalledProcessError: if the returncode of the subprocess is non-zero.
        """
        log.debug('run %r', cmd)
        if not kwargs.pop('check', True):  # pragma: no cover
            raise NotImplementedError('check must be True or omited')
    
        if encoding is not None:
            kwargs['encoding'] = encoding
    
        kwargs.setdefault('startupinfo', _compat.get_startupinfo())
    
        try:
            if input_lines is not None:
                assert kwargs.get('input') is None
                assert iter(input_lines) is input_lines
                if kwargs.pop('capture_output'):
                    kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE
                proc = _run_input_lines(cmd, input_lines, kwargs=kwargs)
            else:
                proc = subprocess.run(cmd, **kwargs)
        except OSError as e:
            if e.errno == errno.ENOENT:
>               raise ExecutableNotFound(cmd) from e
E               graphviz.backend.execute.ExecutableNotFound: failed to execute WindowsPath('dot'), make sure the Graphviz executables are on your systems' PATH

.tox\test-workflow\lib\site-packages\graphviz\backend\execute.py:81: ExecutableNotFound
test_server.test_server::test_docker_busy_port[gRPC CLayer]
Stack Traces | 23s run time
remote_config_server_type = <ansys.dpf.core.server_factory.ServerConfig object at 0x00000226CFC81270>
clean_up = None

    @pytest.mark.skipif(not running_docker, reason="Only works on Docker")
    def test_docker_busy_port(remote_config_server_type, clean_up):
        my_serv = start_local_server(config=remote_config_server_type)
        busy_port = my_serv.external_port
        with pytest.raises(errors.InvalidPortError):
            running_docker_config = dpf.core.server_factory.RunningDockerConfig(
                docker_config=dpf.core.server.RUNNING_DOCKER
            )
>           server_types.launch_dpf_on_docker(
                port=busy_port, running_docker_config=running_docker_config
            )

test_server\test_server.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ansys\dpf\core\server_types.py:312: in launch_dpf_on_docker
    _wait_and_check_server_connection(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

process = <Popen: returncode: 125 args: 'docker run -d   -e ANSYS_DPF_ACCEPT_LA=Y  -e ...>
port = 50059, timeout = 50.0, lines = []
current_errors = ['docker: Error response from daemon: failed to create endpoint magical_galois on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists. (0x803b0013).\n']
stderr = <function launch_dpf_on_docker.<locals>.read_stderr at 0x00000226D13065F0>
stdout = <function launch_dpf_on_docker.<locals>.read_stdout at 0x00000226D0F8F490>

    def _wait_and_check_server_connection(
        process, port, timeout, lines, current_errors, stderr=None, stdout=None
    ):
        if not stderr:
    
            def read_stderr():
                with io.TextIOWrapper(process.stderr, encoding="utf-8") as log_err:
                    for line in log_err:
                        LOG.debug(line)
                        current_errors.append(line)
    
            stderr = read_stderr
            # check to see if the service started
        if not stdout:
    
            def read_stdout():
                with io.TextIOWrapper(process.stdout, encoding="utf-8") as log_out:
                    for line in log_out:
                        LOG.debug(line)
                        lines.append(line)
    
            stdout = read_stdout
        # must be in the background since the process reader is blocking
        Thread(target=stdout, daemon=True).start()
        Thread(target=stderr, daemon=True).start()
    
        t_timeout = time.time() + timeout
        started = False
        timedout = False
        while not started and len(current_errors) == 0:
            # print(lines)
            started = any("server started" in line for line in lines)
    
            if time.time() > t_timeout:
                if timedout:
                    raise TimeoutError(f"Server did not start in {timeout + timeout} seconds")
                timedout = True
                t_timeout += timeout
    
        # verify there were no errors
        time.sleep(0.01)
        if current_errors:
            try:
                process.kill()
            except PermissionError:
                pass
            errstr = "\n".join(current_errors)
            if (
                "Only one usage of each socket address" in errstr
                or "port is already allocated" in errstr
            ):
                raise errors.InvalidPortError(f"Port {port} in use")
>           raise RuntimeError(errstr)
E           RuntimeError: docker: Error response from daemon: failed to create endpoint magical_galois on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists. (0x803b0013).

C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ansys\dpf\core\server_types.py:221: RuntimeError
test_server.test_server::test_docker_busy_port[ansys-grpc-dpf]
Stack Traces | 31.6s run time
remote_config_server_type = <ansys.dpf.core.server_factory.ServerConfig object at 0x00000226CFC810C0>
clean_up = None

    @pytest.mark.skipif(not running_docker, reason="Only works on Docker")
    def test_docker_busy_port(remote_config_server_type, clean_up):
        my_serv = start_local_server(config=remote_config_server_type)
        busy_port = my_serv.external_port
        with pytest.raises(errors.InvalidPortError):
            running_docker_config = dpf.core.server_factory.RunningDockerConfig(
                docker_config=dpf.core.server.RUNNING_DOCKER
            )
>           server_types.launch_dpf_on_docker(
                port=busy_port, running_docker_config=running_docker_config
            )

test_server\test_server.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ansys\dpf\core\server_types.py:312: in launch_dpf_on_docker
    _wait_and_check_server_connection(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

process = <Popen: returncode: 125 args: 'docker run -d   -e ANSYS_DPF_ACCEPT_LA=Y  -e ...>
port = 50059, timeout = 50.0, lines = []
current_errors = ['docker: Error response from daemon: failed to create endpoint friendly_driscoll on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists. (0x803b0013).\n']
stderr = <function launch_dpf_on_docker.<locals>.read_stderr at 0x00000226D1B2C0D0>
stdout = <function launch_dpf_on_docker.<locals>.read_stdout at 0x00000226D1ADFF40>

    def _wait_and_check_server_connection(
        process, port, timeout, lines, current_errors, stderr=None, stdout=None
    ):
        if not stderr:
    
            def read_stderr():
                with io.TextIOWrapper(process.stderr, encoding="utf-8") as log_err:
                    for line in log_err:
                        LOG.debug(line)
                        current_errors.append(line)
    
            stderr = read_stderr
            # check to see if the service started
        if not stdout:
    
            def read_stdout():
                with io.TextIOWrapper(process.stdout, encoding="utf-8") as log_out:
                    for line in log_out:
                        LOG.debug(line)
                        lines.append(line)
    
            stdout = read_stdout
        # must be in the background since the process reader is blocking
        Thread(target=stdout, daemon=True).start()
        Thread(target=stderr, daemon=True).start()
    
        t_timeout = time.time() + timeout
        started = False
        timedout = False
        while not started and len(current_errors) == 0:
            # print(lines)
            started = any("server started" in line for line in lines)
    
            if time.time() > t_timeout:
                if timedout:
                    raise TimeoutError(f"Server did not start in {timeout + timeout} seconds")
                timedout = True
                t_timeout += timeout
    
        # verify there were no errors
        time.sleep(0.01)
        if current_errors:
            try:
                process.kill()
            except PermissionError:
                pass
            errstr = "\n".join(current_errors)
            if (
                "Only one usage of each socket address" in errstr
                or "port is already allocated" in errstr
            ):
                raise errors.InvalidPortError(f"Port {port} in use")
>           raise RuntimeError(errstr)
E           RuntimeError: docker: Error response from daemon: failed to create endpoint friendly_driscoll on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The specified port already exists. (0x803b0013).

C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\ansys\dpf\core\server_types.py:221: RuntimeError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

Support windows-based containers

1 participant