(
style, # type: str
*additional_args # type: str
)
| 104 | pex_root = os.path.join(str(tmpdir), "pex_root") |
| 105 | |
| 106 | def create_lock( |
| 107 | style, # type: str |
| 108 | *additional_args # type: str |
| 109 | ): |
| 110 | # type: (...) -> LockedRequirement |
| 111 | lock_file = os.path.join(str(tmpdir), "{}.lock".format(style)) |
| 112 | args = ( |
| 113 | "lock", |
| 114 | "create", |
| 115 | "psutil==5.9.0", |
| 116 | "-o", |
| 117 | lock_file, |
| 118 | "--style", |
| 119 | style, |
| 120 | "--pex-root", |
| 121 | pex_root, |
| 122 | "--no-avoid-downloads", |
| 123 | ) |
| 124 | run_pex3(*(args + additional_args)).assert_success() |
| 125 | lock = json_codec.load(lock_file) |
| 126 | assert 1 == len(lock.locked_resolves) |
| 127 | locked_resolve = lock.locked_resolves[0] |
| 128 | assert 1 == len(locked_resolve.locked_requirements) |
| 129 | locked_requirement = locked_resolve.locked_requirements[0] |
| 130 | download_dir = CacheDir.DOWNLOADS.path( |
| 131 | locked_requirement.artifact.fingerprint.hash, pex_root=pex_root |
| 132 | ) |
| 133 | downloaded_artifact = DownloadedArtifact.load(download_dir) |
| 134 | assert os.path.exists(downloaded_artifact.path), ( |
| 135 | "Expected the primary artifact to be downloaded as a side-effect of executing the lock " |
| 136 | "resolve." |
| 137 | ) |
| 138 | assert ( |
| 139 | CacheHelper.hash( |
| 140 | downloaded_artifact.path, digest=downloaded_artifact.fingerprint.new_hasher() |
| 141 | ) |
| 142 | == downloaded_artifact.fingerprint |
| 143 | ), ( |
| 144 | "Expected the primary artifact to have an internal fingerprint established to short " |
| 145 | "circuit builds and installs." |
| 146 | ) |
| 147 | return locked_requirement |
| 148 | |
| 149 | # See: https://pypi.org/project/psutil/5.9.0/#files |
| 150 |
no test coverage detected