From dd321146986212a0be374442ec964be5ee16bf80 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 22 Mar 2023 17:57:48 +0000 Subject: [PATCH] delete test upload file after test --- core/TESTS/test_logins.py | 8 ++++---- core/views/wallets_edit.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/TESTS/test_logins.py b/core/TESTS/test_logins.py index f50e292..e17ad43 100644 --- a/core/TESTS/test_logins.py +++ b/core/TESTS/test_logins.py @@ -151,7 +151,6 @@ class PostTests(TestCase): ) content = response.content.decode() self.assertEqual(response.status_code, HTTPStatus.OK) - self.assertEqual(response.status_code, HTTPStatus.OK) with open("_test_response.html", "w") as f: f.write(content) for ph in [ @@ -165,9 +164,10 @@ class PostTests(TestCase): self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") # # Does not use the filename Django actually uses, assumes it is unchanged. Potential bug. - # remove_file = pathlib.Path(settings.SCANS_ROOT) / f'{testyear}' / f'{testyear}#00'/ 'test_upload_file.txt' - # remove_file.unlink() - # # Undo the auto create and commit of a new wallet + remove_file = pathlib.Path(settings.SCANS_ROOT) / f'{testyear}' / f'{testyear}#00'/ 'test_upload_file.txt' + remove_file.unlink() + + # # Undo the auto create and commit of a new wallet. Why is the commit not happening when we run the test? # cwd = settings.DRAWINGS_DATA # sp = subprocess.run([settings.GIT, "reset", "--hard", "master^"], cwd=cwd, capture_output=True, text=True) # print(f'git output: {cwd}:\n # {sp.stderr=}\n # {sp.stdout=} \n # return code: {str(sp.returncode)}') diff --git a/core/views/wallets_edit.py b/core/views/wallets_edit.py index 320217e..67aab15 100644 --- a/core/views/wallets_edit.py +++ b/core/views/wallets_edit.py @@ -401,7 +401,7 @@ def walletedit(request, path=None): def save_json(jsondict): # print(f'--- Wallet directory in :drawings: repo {newfolder=} {jsondict}') if not os.path.exists(contents_path.parent): - print("--- No wallet directory in :drawings: repo, so creating it") + print(f"--- No wallet directory in :drawings: repo, so creating it {contents_path.parent}") os.makedirs(contents_path.parent) with open(contents_path, "w") as jfile: