uga-libraries / hub-monitoring

Scripts for summarizing and validating content on the Digital Production Hub, the UGA Libraries' centralized storage for digital objects that are not suitable for our digital preservation system.
Creative Commons Attribution Share Alike 4.0 International
1 stars 0 forks source link

Error prevents unit tests when a script imports from another script #101

Open amhanson9 opened 2 weeks ago

amhanson9 commented 2 weeks ago

The scripts collection_summary.py and format_list.py imports the functions most_recent_risk_csv from risk_update and check_argument from validate_fixity. The script risk_update.py imports the function accession_test from collection_summary. Unit tests for these have started failing with this error:

ImportError: cannot import name 'FUNCTION' from partially initialized module 'SCRIPT' (most likely due to a circular import)

The collection_summary.py and format_list.py tests have previously passed, so I'm not sure what caused this to start happening. The import in risk_update.py is new, to add new functionality. I didn't find an obvious solution online, so for now copy all the functions into the scripts that use them, with a note to help keep them in sync. But it would be easier to maintain if we can get this working again. Tests started passing with check_argument still imported, so left it there.

amhanson9 commented 2 weeks ago

@emkaser Heads up about this, in case you do development. I don't love having the same function copied, so we can try to figure out how solve the error if we're developing this much. In the meantime, the docstring includes which scripts have a copy of the function and which script has the unit tests for it.