Skip to content

Rename pyrocky package path #22

Rename pyrocky package path

Rename pyrocky package path #22

GitHub Actions / Pytest Report failed Nov 20, 2023 in 0s

Pytest Report ❌

Tests failed

❌ build/pytest.xml

1 tests were completed in 24s with 0 passed, 1 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 1❌ 24s

❌ pytest

tests.test_pyrocky
  ❌ test_minimal_simulation
	rocky_session = <ansys.rocky.core.client.RockyClient object at 0x000001C581703C10>

Annotations

Check failure on line 0 in build/pytest.xml

See this annotation in the file changed.

@github-actions github-actions / Pytest Report

pytest ► tests.test_pyrocky ► test_minimal_simulation

Failed test found in:
  build/pytest.xml
Error:
  rocky_session = <ansys.rocky.core.client.RockyClient object at 0x000001C581703C10>
Raw output
rocky_session = <ansys.rocky.core.client.RockyClient object at 0x000001C581703C10>
tmp_path = WindowsPath('C:/Users/ansys/AppData/Local/Temp/pytest-of-ansys/pytest-20/test_minimal_simulation0')

    def test_minimal_simulation(rocky_session, tmp_path):
        rocky = pyrocky.connect_to_rocky()
        project = rocky.api.CreateProject()
        assert project, "No project created"
    
        study = project.GetStudy()
        particle = study.CreateParticle()
    
        inlet_surface = study.CreateCircularSurface()
        study.CreateParticleInlet(entry_point=inlet_surface, particle=particle)
    
        domain = study.GetDomainSettings()
        domain.DisableUseBoundaryLimits()
        domain.SetCoordinateLimitsMaxValues((10, 1, 10))
    
        solver = study.GetSolver()
        solver.SetSimulationDuration(2)  # Simulate for 2 sec.
    
        project.SaveProject(str(tmp_path / "rocky-testing.rocky"))
        study.StartSimulation()
    
>       particles_count = study.GetParticles().GetNumpyCurve("Particles Count")

tests\test_pyrocky.py:34: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src\ansys\rocky\core\client.py:43: in GetNumpyCurve
    serpent_dicts = api.SendToApiElement(
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\client.py:510: in __call__
    return self.__send(self.__name, args, kwargs)
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\client.py:268: in _pyroInvoke
    data = serializer.loads(msg.data)
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\serializers.py:290: in loads
    return self.recreate_classes(serpent.loads(data))
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\serializers.py:253: in recreate_classes
    return tuple(self.recreate_classes(x) for x in literal)
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\serializers.py:253: in <genexpr>
    return tuple(self.recreate_classes(x) for x in literal)
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\serializers.py:256: in recreate_classes
    return self.dict_to_class(literal)
..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\serializers.py:309: in dict_to_class
    return super(SerpentSerializer, cls).dict_to_class(data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'Pyro5.serializers.SerpentSerializer'>
data = {'__class__': 'ndarray', 'bytes': {'data': 'gAJjbnVtcHkuY29yZS5tdWx0aWFycmF5Cl9yZWNvbnN0cnVjdApxAGNudW1weQpuZGFycmF5Cn...ONw4zDjMOMw4zDjMO8P8KawpnCmcKZwpnCmcO9P2ZmZmZmZsO+PzMzMzMzM8O/PwAAAAAAAABAcRFoBYZxElJxE3RxFGIu', 'encoding': 'base64'}}

    @classmethod
    def dict_to_class(cls, data):
        """
        Recreate an object out of a dict containing the class name and the attributes.
        Only a fixed set of classes are recognized.
        """
        from . import core, client, server  # circular imports...
        classname = data.get("__class__", "<unknown>")
        if isinstance(classname, bytes):
            classname = classname.decode("utf-8")
        if classname in cls.__custom_dict_to_class_registry:
            converter = cls.__custom_dict_to_class_registry[classname]
            return converter(classname, data)
        if "__" in classname:
            raise errors.SecurityError("refused to deserialize types with double underscores in their name: " + classname)
        # for performance reasons, the constructors below are hardcoded here
        # instead of added on a per-class basis to the dict-to-class registry
        if classname == "Pyro5.core.URI":
            uri = core.URI.__new__(core.URI)
            uri.__setstate__(data["state"])
            return uri
        elif classname == "Pyro5.client.Proxy":
            proxy = client.Proxy.__new__(client.Proxy)
            proxy.__setstate__(data["state"])
            return proxy
        elif classname == "Pyro5.server.Daemon":
            daemon = server.Daemon.__new__(server.Daemon)
            daemon.__setstate__(data["state"])
            return daemon
        elif classname.startswith("Pyro5.util."):
            if classname == "Pyro5.util.SerpentSerializer":
                return SerpentSerializer()
            elif classname == "Pyro5.util.MarshalSerializer":
                return MarshalSerializer()
            elif classname == "Pyro5.util.JsonSerializer":
                return JsonSerializer()
            elif classname == "Pyro5.util.MsgpackSerializer":
                return MsgpackSerializer()
        elif classname.startswith("Pyro5.errors."):
            errortype = getattr(errors, classname.split('.', 2)[2])
            if issubclass(errortype, errors.PyroError):
                return SerializerBase.make_exception(errortype, data)
        elif classname == "struct.error":
            return SerializerBase.make_exception(struct.error, data)
        elif classname == "Pyro5.core._ExceptionWrapper":
            ex = data["exception"]
            if isinstance(ex, dict) and "__class__" in ex:
                ex = SerializerBase.dict_to_class(ex)
            return core._ExceptionWrapper(ex)
        elif data.get("__exception__", False):
            if classname in all_exceptions:
                return SerializerBase.make_exception(all_exceptions[classname], data)
            # translate to the appropriate namespace...
            namespace, short_classname = classname.split('.', 1)
            if namespace in ("builtins", "exceptions"):
                exceptiontype = getattr(builtins, short_classname)
                if issubclass(exceptiontype, BaseException):
                    return SerializerBase.make_exception(exceptiontype, data)
            elif namespace == "sqlite3" and short_classname.endswith("Error"):
                import sqlite3
                exceptiontype = getattr(sqlite3, short_classname)
                if issubclass(exceptiontype, BaseException):
                    return SerializerBase.make_exception(exceptiontype, data)
        log.warning("unsupported serialized class: " + classname)
>       raise errors.SerializeError("unsupported serialized class: " + classname)
E       Pyro5.errors.SerializeError: unsupported serialized class: ndarray

..\..\..\..\AppData\Local\Programs\Python\Python311\Lib\site-packages\Pyro5\serializers.py:235: SerializeError