Skip to content

Commit

Permalink
Get tests working on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Janzert committed May 27, 2021
1 parent d620e25 commit 12ab4f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions pyrimaa/tests/test_aei.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import os.path
import socket
import sys
import unittest

from pyrimaa import aei, board
Expand Down Expand Up @@ -279,12 +280,13 @@ def test_stdioengine(self):

def test_socketengine(self):
path = os.path.dirname(__file__)
adapter = os.path.join(path, "socketadapter.py")
eng = aei.get_engine("socket", adapter)
adapter_path = os.path.join(path, "socketadapter.py")
adapter_cmd = "%s %s" % (sys.executable, adapter_path)
eng = aei.get_engine("socket", adapter_cmd)
self.assertIsInstance(eng, aei.SocketEngine)
self._check_engine(eng)
eng = aei.get_engine("socket", adapter, "aei")
eng = aei.get_engine("socket", adapter_cmd, "aei")
self.assertIsInstance(eng, aei.SocketEngine)
self._check_engine(eng)
eng = aei.get_engine("2008cc", adapter + " --legacy")
eng = aei.get_engine("2008cc", adapter_cmd + " --legacy")
self._check_engine(eng)
5 changes: 3 additions & 2 deletions pyrimaa/tests/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ def test_config(self):
self.assertEqual(ret, 0)
self.assertNotIn("bestmove:", stdout)
finally:
cfg.close()
aei._ProcCom = real_ProcCom

def test_board(self):
Expand All @@ -394,7 +395,7 @@ def test_board(self):
pos.seek(0)
pos.truncate(0)
pos.write(b"no board or moves")
pos.flush()
pos.close()
with save_stdio() as (out, err):
ret = analyze.main(["--config", cfg.name, pos.name])
stdout = out.getvalue()
Expand Down Expand Up @@ -447,7 +448,7 @@ def test_movechecks(self):
pos.seek(0)
pos.truncate(0)
pos.write(illegal_setup.encode("utf-8"))
pos.flush()
pos.close()
with save_stdio() as (out, err):
ret = analyze.main(["--config", cfg.name, pos.name,
"--strict-setup"])
Expand Down

0 comments on commit 12ab4f1

Please sign in to comment.