Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Apr 28, 2024
1 parent 9c5c513 commit d078438
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions tests/pe/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_tls():
tls = winhello64.tls

assert tls.addressof_callbacks == 0x409040
assert tls.callbacks, [0x4019c0 == 0x401990]
assert tls.callbacks == [0x4019c0, 0x401990]
assert tls.addressof_index == 0x4075fc
assert tls.sizeof_zero_fill == 0
assert tls.characteristics == 0
Expand Down Expand Up @@ -393,6 +393,7 @@ def test_issue_685():
assert exports.entries[0].name == "oplk"

entry = exports.entries[0]
assert entry is not None

def test_rich_header():
rheader = atapi.rich_header
Expand Down Expand Up @@ -520,7 +521,6 @@ def test_checksum():
assert winhello64.optional_header.computed_checksum == winhello64.optional_header.checksum

def test_config():

config = lief.PE.ParserConfig()
config.parse_signature = False
config.parse_imports = False
Expand All @@ -540,6 +540,5 @@ def test_overlay():
assert len(pe.overlay) == 3073728
assert hashlib.sha256(pe.overlay).hexdigest() == "01c0472ead112b44dca6996c9fae47e0d6870e61792ef606ea47067932115d01"


def test_path_like():
assert lief.PE.parse(Path(get_sample('PE/PE32_x86-64_binary_avast-free-antivirus-setup-online.exe'))) is not None
6 changes: 3 additions & 3 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def _win_gui_exec(executable: Path, timeout: int = 60) -> Optional[Tuple[int, st
"creationflags": 0x8000000 # win32con.CREATE_NO_WINDOW
}

with Popen(["START", executable.as_posix()], **popen_args) as proc:
with Popen(["START", executable.as_posix()], **popen_args) as proc: # type: ignore[call-overload]
time.sleep(3)
with Popen(["taskkill", "/im", executable.name], **popen_args) as kproc:
with Popen(["taskkill", "/im", executable.name], **popen_args) as kproc: # type: ignore[call-overload]
try:
pstdout, _ = proc.communicate(timeout)
print("pstdout:", pstdout)
Expand All @@ -136,7 +136,7 @@ def win_exec(executable: Path, timeout: int = 60, gui: bool = True) -> Optional[
"creationflags": 0x8000000 # win32con.CREATE_NO_WINDOW
}

with Popen([executable.as_posix()], **popen_args) as proc:
with Popen([executable.as_posix()], **popen_args) as proc: # type: ignore[call-overload]
try:
stdout, _ = proc.communicate(timeout)
print("stdout:", stdout)
Expand Down

0 comments on commit d078438

Please sign in to comment.