Skip to content

Commit

Permalink
Add removal of NamedTemporaryFile and correct the docstring
Browse files Browse the repository at this point in the history
Modify the positioning of replacement text of `arti_shot`s

Signed-off-by: Shounak Dey <[email protected]>
  • Loading branch information
sdglitched authored and gridhead committed Oct 30, 2024
1 parent c2904f4 commit 06e7214
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
2 changes: 2 additions & 0 deletions gi_loadouts/face/scan/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(self):
def load_mask_from_file(self, path: str) -> Tuple[QPixmap, ImageFile]:
"""
Handle file operations involved in loading data from the storage device
Backend
:return: Image that is intended to be read from
"""
Expand All @@ -25,6 +26,7 @@ def load_mask_from_file(self, path: str) -> Tuple[QPixmap, ImageFile]:
def load_screenshot_with_picker(self, prnt, head: str) -> Tuple[bool, QPixmap, ImageFile]:
"""
Handle file operations involved in loading data from the storage device
Frontend
:return: Image that is intended to be read from
"""
Expand Down
8 changes: 1 addition & 7 deletions gi_loadouts/face/scan/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,4 @@ def wipe_snapshot(self) -> None:
:return:
"""
self.arti_shot.setText("""
<html><head/><body>
<p align="center">YOUR ARTIFACT SCREENSHOT WILL SHOW UP HERE</p>
<p align="center">IF YOU HAVE AN ARTIFACT SCREENSHOT IN YOUR CLIPBOARD, SIMPLY PRESS <span style=" font-weight:700;">CTRL + V</span> TO PASTE IT HERE</p>
<p align="center">DRAG AND DROP WORKS AS WELL</p>
</body></html>
""")
self.arti_shot.setText("<html><head/><body><p align=\"center\">YOUR ARTIFACT SCREENSHOT WILL SHOW UP HERE</p><p align=\"center\">IF YOU HAVE AN ARTIFACT SCREENSHOT IN YOUR CLIPBOARD, SIMPLY PRESS <span style=\" font-weight:700;\">CTRL + V</span> TO PASTE IT HERE</p><p align=\"center\">DRAG AND DROP WORKS AS WELL</p></body></html>")
18 changes: 5 additions & 13 deletions test/face/scan/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ def test_scan_arti_scan_fail(scantest: ScanDialog, qtbot: QtBot, mocker: MockerF
assert "Please select an accurate screenshot." in scantest.dialog.text()
assert scantest.dialog.isVisible()

"""
Cleanup the temporary files from temp directory
"""
remove(savefile.name)


@pytest.mark.parametrize(
"_",
Expand Down Expand Up @@ -703,14 +708,6 @@ def test_scan_arti_scan_fail_ic(scantest: ScanDialog, _: None) -> None:
:return:
"""

"""
Create a temporary file filled with random data to simulate a failure when trying to open an
image using PIL.Image.open().
"""
savefile = NamedTemporaryFile(prefix="gi-loadouts-", suffix=".exe", delete=False, mode="wb")
savefile.write(randbytes(512*1024))
savefile.close()

"""
Perform the action of loading the artifact information
"""
Expand All @@ -727,11 +724,6 @@ def test_scan_arti_scan_fail_ic(scantest: ScanDialog, _: None) -> None:
assert "Please select an accurate screenshot." in scantest.dialog.text()
assert scantest.dialog.isVisible()

"""
Cleanup the temporary files from temp directory
"""
remove(savefile.name)


@pytest.mark.parametrize(
"_",
Expand Down

0 comments on commit 06e7214

Please sign in to comment.