Browse Source

fix start_engine: `pathlib.Path.parent` is a property not a method

Fabian Peter Hammerle 4 years ago
parent
commit
0deaf0c016
2 changed files with 6 additions and 5 deletions
  1. 5 4
      tests/test_api.py
  2. 1 1
      tooncher/__init__.py

+ 5 - 4
tests/test_.py → tests/test_api.py

@@ -1,3 +1,4 @@
+import pathlib
 import shutil
 import subprocess
 
@@ -7,15 +8,15 @@ import tooncher
 
 
 def test_start_engine():
-    p = tooncher.start_engine(
-        engine_path=shutil.which("printenv"),
+    process = tooncher.start_engine(
+        engine_path=pathlib.Path(shutil.which("printenv")),
         gameserver="gameserver",
         playcookie="cookie",
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
     )
-    assert isinstance(p, subprocess.Popen)
-    stdout, stderr = p.communicate()
+    assert isinstance(process, subprocess.Popen)
+    stdout, stderr = process.communicate()
     assert b"" == stderr
     env = stdout.strip().split(b"\n")
     assert b"TTR_GAMESERVER=gameserver" in env

+ 1 - 1
tooncher/__init__.py

@@ -39,7 +39,7 @@ def start_engine(
         # > Exception: Could not open window.
         env["XAUTHORITY"] = os.environ["XAUTHORITY"]
     return subprocess.Popen(
-        args=[str(engine_path)], cwd=engine_path.parent(), env=env, **popen_kwargs,
+        args=[str(engine_path)], cwd=engine_path.parent, env=env, **popen_kwargs,
     )