-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b76cf9a
commit deee1d6
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import hashlib | ||
import ksh | ||
import os | ||
import psutil | ||
import subprocess | ||
|
||
MD5SUM = "d8a9e839260c00e65cc91be886638871" | ||
|
||
|
||
def test_driver_test(): | ||
ksh.test() | ||
|
||
|
||
def test_driver_cp(): | ||
from_file = "LICENSE" | ||
to_file = "hund" | ||
ksh.cp( | ||
os.path.abspath(".") + "\\" + from_file, os.path.abspath(".") + "\\" + to_file | ||
) | ||
assert os.path.exists(to_file) | ||
assert hashlib.md5(open(to_file, "rb").read()).hexdigest() == MD5SUM | ||
|
||
|
||
def test_driver_mv(): | ||
from_file = "hund" | ||
to_file = "katze" | ||
ksh.mv( | ||
os.path.abspath(".") + "\\" + from_file, os.path.abspath(".") + "\\" + to_file | ||
) | ||
assert os.path.exists(to_file) | ||
assert not os.path.exists(from_file) | ||
assert hashlib.md5(open(to_file, "rb").read()).hexdigest() == MD5SUM | ||
|
||
|
||
def test_driver_rm(): | ||
path = os.path.abspath(".") + "\\" + "katze" | ||
ksh.rm(path) | ||
assert not os.path.exists(path) | ||
|
||
|
||
def test_driver_pkill(): | ||
notepad = "notepad.exe" | ||
process = subprocess.Popen([notepad]) | ||
pid = process.pid | ||
ksh.pkill(pid) | ||
for proc in psutil.process_iter(): | ||
if proc.name() == notepad: | ||
assert pid != proc.pid |