Repository navigation
Conversation
Pass save=False to run_pyscf() in generate_molecular_hamiltonian() so transient MolecularData objects do not write .hdf5 files to openfermion's DATA_DIRECTORY. Update test_run_pyscf() to use pytest's tmp_path fixture and remove the unused module-level MolecularData object. Fixes #65.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #65.
This PR prevents tests and transient calculations from attempting to write
.hdf5files into OpenFermion's default data directory (openfermion.config.DATA_DIRECTORY). When OpenFermion is installed in a read-only system location (e.g. system site-packages), tests previously failed withPermissionError.Changes
generate_molecular_hamiltonian(): passsave=Falsetorun_pyscf()so generating an InteractionOperator does not write molecular data to disk.tests/_run_pyscf_test.py: scopetest_run_pyscf(tmp_path)using pytest'stmp_pathfixture fordata_directory, remove the unused globalmoleculedefinition, and assert that the.hdf5file is written to the temporary directory.Testing
Verified with pytest both with
DATA_DIRECTORYmarked read-only (chmod a-w) and normal permissions:5 passed in 5.00s