1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Do not read selfcheck state file when saving.

This commit is contained in:
Chris Hunt 2019-08-13 21:33:43 -04:00
parent c6c2ee433b
commit 9928409b2f
2 changed files with 7 additions and 10 deletions

View file

@ -78,15 +78,13 @@ class SelfCheckState(object):
# Attempt to write out our version check file
with lockfile.LockFile(self.statefile_path):
if os.path.exists(self.statefile_path):
with open(self.statefile_path) as statefile:
state = json.load(statefile)
else:
state = {}
state[self.key] = {
"last_check": current_time.strftime(SELFCHECK_DATE_FMT),
"pypi_version": pypi_version,
# Since we have a prefix-specific state file, we can just
# overwrite whatever is there, no need to check.
state = {
self.key: {
"last_check": current_time.strftime(SELFCHECK_DATE_FMT),
"pypi_version": pypi_version,
},
}
with open(self.statefile_path, "w") as statefile:

View file

@ -197,7 +197,6 @@ def test_self_check_state(monkeypatch, tmpdir):
assert fake_lock.calls == [pretend.call(expected_path)]
assert fake_open.calls == [
pretend.call(expected_path),
pretend.call(expected_path),
pretend.call(expected_path, 'w'),
]