diff --git a/tests/test_server_side_scripting.py b/tests/test_server_side_scripting.py index 2bb5ba38f9d1c26b0c74d5ae93b533183b273721..65f1d6c7a7fba42010cb67ff5c3b5e77072a1872 100644 --- a/tests/test_server_side_scripting.py +++ b/tests/test_server_side_scripting.py @@ -70,6 +70,28 @@ def clean_database(): d.delete() +def assert_stderr(stderr) -> None: + """Assert that ``stderr`` is either None or contains only the pyarrow deprecation warning. + +This can probably removed with Pandas 3.0, to be replaced by ``assert stderr is None``. + +Parameters +---------- +stderr + The object to be tested. + """ + if stderr is None: + return + assert isinstance(stderr, str) + assert stderr.split(sep="\n", maxsplit=1)[1] == """Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0), +(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries) +but was not found to be installed on your system. +If this would cause problems for you, +please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466 + + i = __import__(m)""" + + def setup_function(function): clean_database() @@ -148,7 +170,7 @@ def test_call_ok(): xml = etree.parse(r) assert xml.xpath("/Response/script/call")[0].text == "ok" assert xml.xpath("/Response/script/stdout")[0].text == "ok" - assert xml.xpath("/Response/script/stderr")[0].text is None + assert_stderr(xml.xpath("/Response/script/stderr")[0].text) assert xml.xpath("/Response/script/@code")[0] == "0" @@ -163,7 +185,7 @@ def test_call_err(): assert xml.xpath("/Response/script/@code")[0] == "1" assert xml.xpath("/Response/script/call")[0].text == "err" assert xml.xpath("/Response/script/stdout")[0].text is None - assert xml.xpath("/Response/script/stderr")[0].text == "err" + assert_stderr(xml.xpath("/Response/script/stderr")[0].text) def test_run_server_side_script_with_file_as_positional_param(): @@ -178,7 +200,7 @@ def test_run_server_side_script_with_file_as_positional_param(): exit="123", query="COUNT ENTITY TestRT", files={"-p2": "test_file.txt"}) - assert response.stderr is None + assert_stderr(response.stderr) assert response.code == 123 assert response.call == ('administration/diagnostics.py ' '--exit=123 --query=COUNT ENTITY TestRT ' @@ -203,7 +225,7 @@ def test_run_server_side_script_with_additional_file(): exit="123", query="COUNT ENTITY TestRT", files={"dummykey": "test_file.txt"}) - assert response.stderr is None + assert_stderr(response.stderr) assert response.code == 123 assert response.call == ('administration/diagnostics.py ' '--exit=123 --query=COUNT ENTITY TestRT ' @@ -250,7 +272,7 @@ def test_diagnostics_basic(): "with code 123.") assert xml.xpath("/Response/script/call")[0].text.startswith( "administration/diagnostics.py") - assert xml.xpath("/Response/script/stderr")[0].text is None + assert_stderr(xml.xpath("/Response/script/stderr")[0].text) def test_diagnostics_with_file_upload(): @@ -293,7 +315,7 @@ def test_diagnostics_with_file_upload(): "with code 0.") assert xml.xpath("/Response/script/call")[0].text.startswith( "administration/diagnostics.py") - assert xml.xpath("/Response/script/stderr")[0].text is None + assert_stderr(xml.xpath("/Response/script/stderr")[0].text) @mark.local_server @@ -403,7 +425,7 @@ def test_anonymous_script_calling_success(): assert xml.xpath("/Response/UserInfo/Roles/Role")[0].text == "anonymous" assert xml.xpath("/Response/script/call")[0].text == "ok_anonymous" assert xml.xpath("/Response/script/stdout")[0].text == "ok_anonymous" - assert xml.xpath("/Response/script/stderr")[0].text is None + assert_stderr(xml.xpath("/Response/script/stderr")[0].text) assert xml.xpath("/Response/script/@code")[0] == "0"