Replace some usages of py.path.local

This commit is contained in:
Ran Benita
2020-08-02 17:56:36 +03:00
parent 70f3ad1c1f
commit f8c4e038fd
8 changed files with 41 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
import json
from pathlib import Path
import py
import requests
issues_url = "https://api.github.com/repos/pytest-dev/pytest/issues"
@@ -31,12 +31,12 @@ def get_issues():
def main(args):
cachefile = py.path.local(args.cache)
cachefile = Path(args.cache)
if not cachefile.exists() or args.refresh:
issues = get_issues()
cachefile.write(json.dumps(issues))
cachefile.write_text(json.dumps(issues), "utf-8")
else:
issues = json.loads(cachefile.read())
issues = json.loads(cachefile.read_text("utf-8"))
open_issues = [x for x in issues if x["state"] == "open"]