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