Skip to content

Commit

Permalink
test print non utf8 char (#1667)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbellot000 authored Aug 1, 2024
1 parent c8e0848 commit 7e91116
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ def return_ds(server=None):

return return_ds

SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_9_1 = meets_version(
get_server_version(core._global_server()), "9.1"
)
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_2 = meets_version(
get_server_version(core._global_server()), "8.2"
)
Expand Down
20 changes: 15 additions & 5 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_loadplugin(server_type):
@pytest.mark.skipif(
platform.system() == "Windows"
and (
platform.python_version().startswith("3.8") or platform.python_version().startswith("3.7")
platform.python_version().startswith("3.8") or platform.python_version().startswith("3.7")
),
reason="Random SEGFAULT in the GitHub pipeline for 3.7-8 on Windows",
)
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_upload_download(tmpdir, server_type_remote_process):

@pytest.mark.skipif(running_docker, reason="Path hidden within docker container")
def test_download_folder(
allkindofcomplexity, plate_msup, multishells, tmpdir, server_type_remote_process
allkindofcomplexity, plate_msup, multishells, tmpdir, server_type_remote_process
):
tmpdir = str(tmpdir)
file = dpf.core.upload_file_in_tmp_folder(
Expand Down Expand Up @@ -465,8 +465,8 @@ def test_context_environment_variable(reset_context_environment_variable):
# Test raise on wrong value
os.environ[key] = "PREM"
with pytest.warns(
UserWarning,
match="which is not recognized as an available " "DPF ServerContext type.",
UserWarning,
match="which is not recognized as an available " "DPF ServerContext type.",
):
reload(s_c)
assert s_c.SERVER_CONTEXT == s_c.AvailableServerContexts.premium
Expand Down Expand Up @@ -537,7 +537,7 @@ def test_license_context_manager_as_context(server_type):
op.inputs.field(field)
op.inputs.threshold(0.0)
with dpf.core.LicenseContextManager(
increment_name="ansys", license_timeout_in_seconds=1.0, server=server_type
increment_name="ansys", license_timeout_in_seconds=1.0, server=server_type
) as lic:
out = op.outputs.field()
st = lic.status
Expand All @@ -546,5 +546,15 @@ def test_license_context_manager_as_context(server_type):
assert "ansys" not in st


@pytest.mark.skipif(
not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_9_1,
reason="Bug"
)
def test_print_non_utf8_string():
op = dpf.core.Operator("generate_uuid")
out_str = op.get_output(0, dpf.core.types.string)
assert len(str(out_str)) > 0


if __name__ == "__main__":
test_load_api_with_awp_root()

0 comments on commit 7e91116

Please sign in to comment.