Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing on test_get_user_dict #2

Open
diligentgiantsquid opened this issue Sep 6, 2024 · 1 comment
Open

Tests failing on test_get_user_dict #2

diligentgiantsquid opened this issue Sep 6, 2024 · 1 comment

Comments

@diligentgiantsquid
Copy link

Hi,
First, many thanks for developing this package - I was looking for a convenient way to pull information from our PPMS, and thought I would try this.

I tried running the tests, starting just in offline mode, but I'm getting a failure on test_get_user_dict:
pyppms test error.txt

I wondered if, running on Windows, I might need to change the format of the paths to the cached responses? Or do I need to set the ppms required values, even before running the online test?

Many thanks for any help.
Huw

@hzqfox
Copy link

hzqfox commented Dec 10, 2024

Hi Huw,

By reading your error log, I think this error related to the PPMS preparation session. In addition you probably need to fix a small glitch on csv format when creating the cached responses:

1, prepare PPMS: (https://github.com/imcf/pyppms/blob/main/TESTING.md#ppms-preparations)
This is a manual set up you have to do on CRUK-CI PPMS, to create the test group, users, and system. You don't have to be super-admin but you have to be local facility admin with enough rights enabled to do this. When you run the "show_required_ppms_values.py" script in the tests folder, it will show you the details of the setup. I assume you have a PUMAPI document to refer to what attributes means what? For me, it is as follows:

#################### group ####################
headname -> PythonGroup Supervisor
unitname -> Python Core Facility
heademail -> [email protected]
unitlogin -> pyppms_group
department -> Scientific Software Support
institution -> Famous Research Foundation
active -> True

#################### system ####################
Name -> Python Development System
Type -> Virtualized Workstation
Localisation -> VDI (Development)
Active -> True

#################### user_admin ####################
lname -> Python
fname -> PumAPI (Administrator)
email -> [email protected]
login -> pyppms-adm
phone -> +98 (76) 54 3112
unitlogin -> pyppms_group
active -> True

#################### user_standard ####################
lname -> Python
fname -> PumAPI
email -> [email protected]
login -> pyppms
phone -> +98 (76) 54 3210
unitlogin -> pyppms_group
active -> True

#################### user_inactive ####################
lname -> Python
fname -> PumAPI (Deactivated)
email -> [email protected]
login -> pyppms-deact
phone -> +98 (76) 54 3007
unitlogin -> pyppms_group
active -> True

2, I think when creating the cached responses, the csv python library create a new line at end of every line? You can open one to check in the created stage_0 folder As a consequence, the .txt files containing those info pulled from PPMS have empty line in between contents. And sometimes this empty lines cause certain function to create empty object that resulting in error. This type of error, for instance, could look like this: KeyError: 'User [] is unknown to PPMS'
To fix this, You can update line 363 of the ppms.py script:
original:
with open(intercept_file, "w", encoding="utf-8") as outfile:
modified:
with open(intercept_file, "w", encoding="utf-8", newline='') as outfile:

Cheers,

Greeting from your old colleague
Ziqiang Huang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants