Skip to content

Commit

Permalink
fix(pyrfc): get_function_description removed from package interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Jul 11, 2023
1 parent 1ae8f9d commit 4268381
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 57 deletions.
6 changes: 3 additions & 3 deletions examples/clientIDoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initial_screen():
# print("\t2: Display current pending IDocs")
print("\t0:\t Exit")
try:
choice = int(input("Enter choice: ")) # noqa WPS110
choice = int(input("Enter choice: ")) # WPS110
except ValueError:
choice = 0
return choice
Expand Down Expand Up @@ -82,15 +82,15 @@ def main():
unit = connection.initialize_unit(background=False)
print(f" - (t/qRFC) Using unit id = {unit['id']}")
if choice == 2: # bgRFC, type 'Q'
queue_input = input("Enter queue names (comma separated): ") # noqa WPS110
queue_input = input("Enter queue names (comma separated): ") # WPS110
queue_names = [qi.strip() for qi in queue_input.split(",")]
connection.fill_and_submit_unit(
unit,
[("IDOC_INBOUND_ASYNCHRONOUS", idoc)],
queue_names=queue_names,
)
elif choice == 4: # qRFC
queue_input = input("Enter queue name: ") # noqa WPS110
queue_input = input("Enter queue name: ") # WPS110
queue = queue_input.strip()
connection.fill_and_submit_unit(
unit,
Expand Down
2 changes: 1 addition & 1 deletion examples/server/bgrfc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

print(unit, client.get_unit_state(unit))

input("Press Enter ...\n") # noqa WPS110
input("Press Enter ...\n") # WPS110

print(unit, client.get_unit_state(unit))

Expand Down
6 changes: 3 additions & 3 deletions examples/server/bgrfc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def stfc_write_to_tcpic(request_context, RESTART_QNAME="", TCPICDAT=None):
# except Exception as ex:
# print(ex)

if context["call_type"] != UnitCallType.synchronous: # noqa SIM102
if context["call_type"] != UnitCallType.synchronous: # SIM102
# Store the data received in funcHandle as well as any results
# computed in the business functionality of the FM (if any)
# via the DB connection obtained above.
# Optionally, if you want to make status tracking and forensic analysis
# in case of an error easier, you can update the TIDs status to EXECUTED
# in case of an error easier, you can update the TID`s status to EXECUTED
# in this step.
if tid is not None:
tlog.write(tid, UnitState.executed, "stfc_write_to_tcpic")
Expand Down Expand Up @@ -179,7 +179,7 @@ def onGetStateFunction(rfcHandle, unit_identifier):
# start server
server.start()

input("Press Enter key to stop server...\n") # noqa WPS110
input("Press Enter key to stop server...\n") # WPS110

# stop server and database
server.stop()
Expand Down
2 changes: 1 addition & 1 deletion examples/server/server_app_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def launch_server():
server_thread = Thread(target=launch_server)
server_thread.start()

input("Press Enter to stop server...") # noqa WPS110
input("Press Enter to stop server...") # WPS110

# stop server
server_thread.join()
Expand Down
2 changes: 1 addition & 1 deletion examples/server/server_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def my_stfc_connection(request_context=None, REQUTEXT=""):
# start server
server.start()

input("Press Enter to stop server...") # noqa WPS110
input("Press Enter to stop server...") # WPS110

# stop server
server.stop()
Expand Down
2 changes: 1 addition & 1 deletion examples/server/server_pyrfc_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def my_auth_check(func_name=False, request_context=None):
# get server attributes
print(server.get_server_attributes())

input("Press Enter to stop server...") # noqa WPS110
input("Press Enter to stop server...") # WPS110

# stop server
server.stop()
Expand Down
1 change: 1 addition & 0 deletions output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"content": {"suites": {"0": {"status": {"total_pass": 9, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}, "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_config_rstrip_false", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_config_rstrip_true", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_config_dtime_true", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_config_dtime_false", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_config_return_import_params_false", "rerun": "0"}, "5": {"status": "PASS", "message": "", "test_name": "test_config_return_import_params_true", "rerun": "0"}, "6": {"status": "PASS", "message": "", "test_name": "test_config_timeout", "rerun": "0"}, "7": {"status": "PASS", "message": "", "test_name": "test_config_not_supported", "rerun": "0"}, "8": {"status": "PASS", "message": "", "test_name": "test_config_parameter", "rerun": "0"}}, "suite_name": "tests/test_client_config.py"}, "1": {"suite_name": "tests/test_connection.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_sdk_version_and_options_getters", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_pyrfc_version", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_connection_info", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_connection_info_attributes", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_connection_info_disconnected", "rerun": "0"}, "5": {"status": "PASS", "message": "", "test_name": "test_reopen", "rerun": "0"}, "6": {"status": "PASS", "message": "", "test_name": "test_call_over_closed_connection", "rerun": "0"}, "7": {"status": "PASS", "message": "", "test_name": "test_ping", "rerun": "0"}, "8": {"status": "PASS", "message": "", "test_name": "test_RFM_name_string", "rerun": "0"}, "9": {"status": "PASS", "message": "", "test_name": "test_RFM_name_unicode", "rerun": "0"}, "10": {"status": "PASS", "message": "", "test_name": "test_RFM_name_invalid_type", "rerun": "0"}, "11": {"status": "PASS", "message": "", "test_name": "test_STFC_returns_structure_and_table", "rerun": "0"}, "12": {"status": "PASS", "message": "", "test_name": "test_STFC_STRUCTURE", "rerun": "0"}, "13": {"status": "PASS", "message": "", "test_name": "test_STFC_CHANGING", "rerun": "0"}}, "status": {"total_pass": 14, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "2": {"suite_name": "tests/test_datatypes.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_structure_rejects_non_dict", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_table_rejects_non_list", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_basic_datatypes", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_string_unicode", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_date_output", "rerun": "0"}, "5": {"status": "PASS", "message": "", "test_name": "test_min_max_positive", "rerun": "0"}, "6": {"status": "PASS", "message": "", "test_name": "test_min_max_negative", "rerun": "0"}, "7": {"status": "PASS", "message": "", "test_name": "test_bcd_floats_accept_floats", "rerun": "0"}, "8": {"status": "PASS", "message": "", "test_name": "test_bcd_floats_accept_strings", "rerun": "0"}, "9": {"status": "PASS", "message": "", "test_name": "test_bcd_floats_accept_strings_radix_comma", "rerun": "0"}, "10": {"status": "PASS", "message": "", "test_name": "test_bcd_floats_accept_decimals", "rerun": "0"}, "11": {"status": "PASS", "message": "", "test_name": "test_raw_types_accept_bytes", "rerun": "0"}, "12": {"status": "PASS", "message": "", "test_name": "test_raw_types_accept_bytearray", "rerun": "0"}, "13": {"status": "PASS", "message": "", "test_name": "test_date_time", "rerun": "0"}, "14": {"status": "PASS", "message": "", "test_name": "test_date_accepts_string", "rerun": "0"}, "15": {"status": "PASS", "message": "", "test_name": "test_date_accepts_date", "rerun": "0"}, "16": {"status": "PASS", "message": "", "test_name": "test_time_accepts_string", "rerun": "0"}, "17": {"status": "PASS", "message": "", "test_name": "test_time_accepts_time", "rerun": "0"}, "18": {"status": "PASS", "message": "", "test_name": "test_error_int_rejects_string", "rerun": "0"}, "19": {"status": "PASS", "message": "", "test_name": "test_error_int_rejects_float", "rerun": "0"}, "20": {"status": "PASS", "message": "", "test_name": "test_error_string_rejects_None", "rerun": "0"}, "21": {"status": "PASS", "message": "", "test_name": "test_error_string_rejects_int", "rerun": "0"}, "22": {"status": "PASS", "message": "", "test_name": "test_float_rejects_not_a_number_string", "rerun": "0"}, "23": {"status": "PASS", "message": "", "test_name": "test_float_rejects_array", "rerun": "0"}, "24": {"status": "PASS", "message": "", "test_name": "test_float_rejects_comma_for_point_locale", "rerun": "0"}, "25": {"status": "PASS", "message": "", "test_name": "test_float_accepts_point_for_point_locale", "rerun": "0"}, "26": {"status": "PASS", "message": "", "test_name": "test_float_rejects_point_for_comma_locale", "rerun": "0"}, "27": {"status": "PASS", "message": "", "test_name": "test_float_accepts_comma_for_comma_locale", "rerun": "0"}, "28": {"status": "PASS", "message": "", "test_name": "test_bcd_rejects_not_a_number_string", "rerun": "0"}, "29": {"status": "PASS", "message": "", "test_name": "test_numc_rejects_non_string", "rerun": "0"}, "30": {"status": "PASS", "message": "", "test_name": "test_numc_rejects_non_numeric_string", "rerun": "0"}, "31": {"status": "PASS", "message": "", "test_name": "test_numc_rejects_empty_string", "rerun": "0"}, "32": {"status": "PASS", "message": "", "test_name": "test_numc_rejects_space_string", "rerun": "0"}, "33": {"status": "PASS", "message": "", "test_name": "test_utclong_accepts_min_max_initial", "rerun": "0"}, "34": {"status": "PASS", "message": "", "test_name": "test_utclong_rejects_non_string_or_invalid_format", "rerun": "0"}}, "status": {"total_pass": 35, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "3": {"suite_name": "tests/test_errors.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_no_connection_params", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_incomplete_params", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_denied_users", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_call_without_RFM_name", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_call_non_existing_RFM", "rerun": "0"}, "5": {"status": "PASS", "message": "", "test_name": "test_call_non_string_RFM_name", "rerun": "0"}, "6": {"status": "PASS", "message": "", "test_name": "test_call_non_existing_RFM_parameter", "rerun": "0"}, "7": {"status": "PASS", "message": "", "test_name": "test_non_existing_field_structure", "rerun": "0"}, "8": {"status": "PASS", "message": "", "test_name": "test_non_existing_field_table", "rerun": "0"}}, "status": {"total_pass": 9, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "4": {"suite_name": "tests/test_errors_abap.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_no_connection_params", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_RFC_RAISE_ERROR", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_STFC_SAPGUI", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_AbapRuntimeError_E0", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_AbapApplicationError_E1", "rerun": "0"}, "5": {"status": "PASS", "message": "", "test_name": "test_AbapApplicationError_E2", "rerun": "0"}, "6": {"status": "PASS", "message": "", "test_name": "test_AbapRuntimeError_E3", "rerun": "0"}, "7": {"status": "PASS", "message": "", "test_name": "test_AbapRuntimeError_A", "rerun": "0"}, "8": {"status": "PASS", "message": "", "test_name": "test_AbapRuntimeError_X", "rerun": "0"}, "9": {"status": "PASS", "message": "", "test_name": "test_AbapRuntimeError_E36", "rerun": "0"}, "10": {"status": "PASS", "message": "", "test_name": "test_AbapRuntimeError_E51", "rerun": "0"}, "11": {"status": "PASS", "message": "", "test_name": "test_pyrfc_exc_string", "rerun": "0"}}, "status": {"total_pass": 12, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "5": {"suite_name": "tests/test_options.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_pass_when_not_requested", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_error_when_all_requested", "rerun": "0"}}, "status": {"total_pass": 2, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "6": {"suite_name": "tests/test_package.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_wheel_package", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_sdist_package", "rerun": "0"}}, "status": {"total_pass": 2, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "7": {"suite_name": "tests/test_rfcsdk.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_reload_ini_file", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_language_iso_sap", "rerun": "0"}}, "status": {"total_pass": 2, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "8": {"suite_name": "tests/test_server.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_add_wrong_function", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_add_function_twice", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_function_description_STFC_STRUCTURE", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_function_description_BAPISDORDER_GETDETAILEDLIST", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_function_description_BS01_SALESORDER_GETDETAIL", "rerun": "0"}, "5": {"status": "SKIP", "message": "('/Users/d037732/SAPDevelop/dev/sap/PyRFC/tests/test_server.py', 87, 'Skipped: manual test only')\n", "test_name": "test_stfc_connection", "rerun": "0"}}, "status": {"total_pass": 5, "total_skip": 1, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "9": {"suite_name": "tests/test_table_type.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_table_type_parameter", "rerun": "0"}}, "status": {"total_pass": 1, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "10": {"suite_name": "tests/test_throughput.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_create_without_connection", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_create_with_single_connection", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_create_with_multiple_connection", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_remove_from_connection", "rerun": "0"}, "4": {"status": "PASS", "message": "", "test_name": "test_create_with_invalid_connection", "rerun": "0"}, "5": {"status": "PASS", "message": "", "test_name": "test_get_from_connection", "rerun": "0"}, "6": {"status": "PASS", "message": "", "test_name": "test_throutput_single_connection", "rerun": "0"}}, "status": {"total_pass": 7, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "11": {"suite_name": "tests/test_timeout.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_timeout_call", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_timeout_call_expired", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_timeout_connection", "rerun": "0"}, "3": {"status": "PASS", "message": "", "test_name": "test_timeout_connection_override", "rerun": "0"}}, "status": {"total_pass": 4, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "12": {"suite_name": "tests/test_wsrfc.py", "tests": {"0": {"status": "SKIP", "message": "('/Users/d037732/SAPDevelop/dev/sap/PyRFC/tests/test_wsrfc.py', 12, 'Skipped: no automatic test')\n", "test_name": "test_load_cryptolib_success", "rerun": "0"}, "1": {"status": "PASS", "message": "", "test_name": "test_load_cryptolib_error", "rerun": "0"}, "2": {"status": "PASS", "message": "", "test_name": "test_wsrfc_call_no_client_pse", "rerun": "0"}, "3": {"status": "SKIP", "message": "('/Users/d037732/SAPDevelop/dev/sap/PyRFC/tests/test_wsrfc.py', 32, 'Skipped: no automatic test')\n", "test_name": "test_wsrfc_call_basic_auth", "rerun": "0"}, "4": {"status": "SKIP", "message": "('/Users/d037732/SAPDevelop/dev/sap/PyRFC/tests/test_wsrfc.py', 38, 'Skipped: no automatic test')\n", "test_name": "test_wsrfc_call_client_cert", "rerun": "0"}}, "status": {"total_pass": 2, "total_skip": 2, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "13": {"suite_name": "tests/stfc-mrfc/test_function_group_mrfc.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_info", "rerun": "0"}}, "status": {"total_pass": 1, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}, "14": {"suite_name": "tests/stfc-mrfc/test_function_group_stfc.py", "tests": {"0": {"status": "PASS", "message": "", "test_name": "test_info", "rerun": "0"}}, "status": {"total_pass": 1, "total_skip": 0, "total_xpass": 0, "total_xfail": 0, "total_rerun": 0, "total_fail": 0, "total_error": 0}}}}, "date": "July 11, 2023", "start_time": 1689077048.806386, "total_suite": 15, "status": "PASS", "status_list": {"pass": "106", "fail": "0", "skip": "3", "error": "0", "xpass": "0", "xfail": "0", "rerun": "0"}, "total_tests": "109"}
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyrfc"
version = "3.0.dev1"
version = "3.0"
readme = "README.md"
license = { file = "LICENSES/Apache-2.0.txt" }
description = "Python bindings for SAP NetWeaver RFC SDK"
Expand Down Expand Up @@ -73,7 +73,7 @@ select = [
]

line-length = 172
target-version = "py37"
target-version = "py38"

[tool.ruff.mccabe]
max-complexity = 100
Expand All @@ -83,7 +83,7 @@ max-complexity = 100
"tests/test_server.py" = ["E402"]

[tool.ruff.pylint]
max-args = 12
max-args = 11
max-branches = 110
max-returns = 12
max-returns = 8
max-statements = 289
5 changes: 2 additions & 3 deletions src/pyrfc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
with suppress(Exception):
os.add_dll_directory(os.path.join(os.environ["SAPNWRFC_HOME"], "lib"))

from pyrfc._exception import CommunicationError # F401
from pyrfc._exception import (
ABAPApplicationError,
ABAPRuntimeError,
CommunicationError,
ExternalApplicationError,
ExternalAuthorizationError,
ExternalRuntimeError,
Expand All @@ -29,8 +29,8 @@
)

try:
from pyrfc._cyrfc import RCStatus
from pyrfc._cyrfc import (
RCStatus,
Connection,
ConnectionParameters,
Decimal,
Expand All @@ -43,7 +43,6 @@
UnitCallType,
UnitState,
cancel_connection,
get_function_description,
get_nwrfclib_version,
language_iso_to_sap,
language_sap_to_iso,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@pytest.mark.skipif(
"tomllib" not in sys.modules
or "darwin" not in sys.platform
or "linux" not in sys.platform
or sys.version_info < latest_python_version,
reason="package check on latest python only",
)
Expand Down
Loading

0 comments on commit 4268381

Please sign in to comment.