============================================================ test session starts ============================================================= platform win32 -- Python 3.10.14, pytest-7.3.2, pluggy-1.0.0 -- C:\Users\Naylor02\AppData\Local\miniforge3\envs\pyppms-env\python.exe cachedir: .pytest_cache rootdir: C:\Users\Naylor02\Documents\Projects_with_code\pyppms configfile: pyproject.toml plugins: anyio-4.3.0, cov-4.1.0 collected 44 items tests/test_booking.py::test_ppmsbooking PASSED [ 2%] tests/test_booking.py::test_starttime_fromstr__time PASSED [ 4%] tests/test_booking.py::test_starttime_fromstr__date PASSED [ 6%] tests/test_booking.py::test_endtime_fromstr__time PASSED [ 9%] tests/test_booking.py::test_endtime_fromstr__date PASSED [ 11%] tests/test_booking.py::test_noendtime_str PASSED [ 13%] tests/test_booking.py::test_booking_from_request PASSED [ 15%] tests/test_booking.py::test_runningsheet PASSED [ 18%] tests/test_booking.py::test_runningsheet_fail PASSED [ 20%] tests/test_common.py::test_dict_from_single_response PASSED [ 22%] tests/test_common.py::test_process_response_values PASSED [ 25%] tests/test_common.py::test_parse_multiline_response PASSED [ 27%] tests/test_common.py::test_time_rel_to_abs PASSED [ 29%] tests/test_ppms.py::test_ppmsconnection_online SKIPPED (need --online option to run) [ 31%] tests/test_ppms.py::test_ppmsconnection PASSED [ 34%] tests/test_ppms.py::test_ppmsconnection_fail_online SKIPPED (need --online option to run) [ 36%] tests/test_ppms.py::test_ppmsconnection_fail PASSED [ 38%] tests/test_ppms.py::test_get_user_ids PASSED [ 40%] tests/test_ppms.py::test_get_user_dict FAILED [ 43%] ================================================================== FAILURES ================================================================== _____________________________________________________________ test_get_user_dict _____________________________________________________________ ppms_connection = user_details_raw = {'active': True, 'affiliation': '', 'bcode': '', 'email': 'pyppms@python-facility.example', ...} user_admin_details_raw = {'active': True, 'affiliation': '', 'bcode': '', 'email': 'pyppms-adm@python-facility.example', ...} def test_get_user_dict(ppms_connection, user_details_raw, user_admin_details_raw): """Test fetching details of a specific user.""" print(f"Expected dict data: {user_details_raw}") > details = ppms_connection.get_user_dict("pyppms") tests\test_ppms.py:171: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , login_name = 'pyppms', skip_cache = False def get_user_dict(self, login_name, skip_cache=False): """Get details on a given user from PPMS. Parameters ---------- login_name : str The PPMS account / login name of the user to query. skip_cache : bool, optional Passed as-is to the :py:meth:`request()` method Returns ------- dict A dict with the user details returned by the PUMAPI. Example ------- >>> conn.get_user_dict('pyppms') ... { ... u'active': True, ... u'affiliation': u'', ... u'bcode': u'', ... u'email': u'pyppms@python-facility.example', ... u'fname': u'PumAPI', ... u'lname': u'Python', ... u'login': u'pyppms', ... u'mustchbcode': False, ... u'mustchpwd': False', ... u'phone': u'+98 (76) 54 3210', ... u'unitlogin': u'pyppms' ... } Raises ------ KeyError Raised in case the user account is unknown to PPMS. ValueError Raised if the user details can't be parsed from the PUMAPI response. """ response = self.request("getuser", {"login": login_name}, skip_cache=skip_cache) if not response.text: msg = f"User [{login_name}] is unknown to PPMS" log.error(msg) > raise KeyError(msg) E KeyError: 'User [pyppms] is unknown to PPMS' src\pyppms\ppms.py:837: KeyError ----------------------------------------------------------- Captured stdout setup ------------------------------------------------------------ NOTE: some tests require either a *CACHED* response to be present or valid settings in `pyppmsconf.py` to talk to a real PUMAPI instance. ----------------------------------------------------------- Captured stderr setup ------------------------------------------------------------ 2024-09-06 11:23:05.582 | DEBUG | pyppms.ppms:__intercept_read:327 - Read intercepted response text from [\auth\response.txt] ------------------------------------------------------------ Captured stdout call ------------------------------------------------------------ Expected dict data: {'lname': 'Python', 'fname': 'PumAPI', 'email': 'pyppms@python-facility.example', 'login': 'pyppms', 'phone': '+98 (76) 54 3210', 'unitlogin': 'pyppms_group', 'mustchbcode': False, 'mustchpwd': False, 'affiliation': '', 'bcode': '', 'active': True} ------------------------------------------------------------ Captured stderr call ------------------------------------------------------------ 2024-09-06 11:23:05.582 | DEBUG | pyppms.ppms:__intercept_read:327 - Read intercepted response text from [\getuser\login--pyppms.txt] 2024-09-06 11:23:05.582 | ERROR | pyppms.ppms:get_user_dict:836 - User [pyppms] is unknown to PPMS ============================================================== warnings summary ============================================================== ..\..\..\AppData\Local\miniforge3\envs\pyppms-env\lib\site-packages\jupyter_client\connect.py:22 C:\Users\Naylor02\AppData\Local\miniforge3\envs\pyppms-env\lib\site-packages\jupyter_client\connect.py:22: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs given by the platformdirs library. To remove this warning and see the appropriate new directories, set the environment variable `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`. The use of platformdirs will be the default in `jupyter_core` v6 from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ---------- coverage: platform win32, python 3.10.14-final-0 ---------- Coverage HTML written to dir htmlcov ========================================================== short test summary info =========================================================== SKIPPED [1] tests\test_ppms.py:93: need --online option to run SKIPPED [1] tests\test_ppms.py:110: need --online option to run !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================= 1 failed, 16 passed, 2 skipped, 1 warning in 0.50s =============================================