mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-19 19:10:17 +00:00
fix test logic
This commit is contained in:
parent
5d4294b457
commit
348b071c1e
@ -6,6 +6,8 @@ except ImportError:
|
||||
import sys
|
||||
is_pkpy = not hasattr(sys, 'getrefcount')
|
||||
|
||||
os.chdir('benchmarks')
|
||||
|
||||
if is_pkpy:
|
||||
try:
|
||||
import cjson as json
|
||||
|
@ -3,6 +3,8 @@ try:
|
||||
except ImportError:
|
||||
exit(0)
|
||||
|
||||
os.chdir('benchmarks')
|
||||
|
||||
import json
|
||||
|
||||
_2489KB = 'WorldMap_GridVania_layout.ldtk'
|
||||
|
@ -3,22 +3,10 @@ import sys
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
class WorkDir:
|
||||
def __init__(self, next):
|
||||
self.prev = os.getcwd()
|
||||
self.next = next
|
||||
|
||||
def __enter__(self):
|
||||
os.chdir(self.next)
|
||||
|
||||
def __exit__(self, *args, **kwargs):
|
||||
os.chdir(self.prev)
|
||||
|
||||
def test_file(filepath, cpython=False):
|
||||
if cpython:
|
||||
x, y = os.path.split(filepath)
|
||||
with WorkDir(x):
|
||||
return os.system("python " + y) == 0
|
||||
return os.system("python " + filepath) == 0
|
||||
if sys.platform == 'win32':
|
||||
return os.system("main.exe " + filepath) == 0
|
||||
else:
|
||||
|
@ -3,7 +3,6 @@ try:
|
||||
except ImportError:
|
||||
exit(0)
|
||||
|
||||
# test import
|
||||
os.chdir('tests')
|
||||
|
||||
import test1
|
||||
|
Loading…
x
Reference in New Issue
Block a user