tests run twice to verify redownloaded acsm can still be converted

This commit is contained in:
Benton Edmondson 2022-06-07 23:48:34 -04:00
parent 398ef79341
commit 1c2b071fd9

View file

@ -17,6 +17,7 @@ if len(sys.argv) != 2:
file=sys.stderr, file=sys.stderr,
) )
sys.exit() sys.exit()
workspace = Path(sys.argv[1])
print("Testing " + str(knock)) print("Testing " + str(knock))
@ -26,11 +27,6 @@ if result.returncode != 0:
sys.exit() sys.exit()
print("---") print("---")
workspace = Path(sys.argv[1])
if workspace.exists():
shutil.rmtree(workspace)
workspace.mkdir()
html = requests.get( html = requests.get(
"https://www.adobe.com/solutions/ebook/digital-editions/sample-ebook-library.html" "https://www.adobe.com/solutions/ebook/digital-editions/sample-ebook-library.html"
).text ).text
@ -48,9 +44,16 @@ for a_tag in soup.find_all("a"):
if len(links) >= 10: if len(links) >= 10:
break break
for time in ["first", "second"]:
if workspace.exists():
shutil.rmtree(workspace)
workspace.mkdir()
for i, link in enumerate(links): for i, link in enumerate(links):
i = str(i) i = str(i)
print("Testing URL #" + i + ":\n" + link)
print("Testing URL #" + i + " for the " + time + " time:\n" + link)
file = workspace.joinpath(i + ".acsm") file = workspace.joinpath(i + ".acsm")
r = requests.get(link) r = requests.get(link)