Verified Commit 555af4b3 authored by w-mj's avatar w-mj

通过所有单元测试

parent b52b394a
......@@ -270,7 +270,7 @@ class Statement(JsonSerializable):
ret['context']['language'] = self.context_language
if self.context_statement_id:
ret['context']['statement'] = {
'id': self.context_statement_id, 'objectType': 'StatementRef'}
'id': str(self.context_statement_id), 'objectType': 'StatementRef'}
ret['context']['contextActivities'] = OrderedDict()
if self._context_ca:
......
......@@ -145,7 +145,13 @@ class TestTracker(unittest.TestCase):
return {"score": run_with_only_case_param(case)}
job = gg.Job(prework=prework, run=run_with_custom_event, config=test_track_config)
job.start()
basic_check_track_result(job)
testcases = job.get_testcases()
statements = get_statements_queue()
statements_len = len(list(statements))
# all statement id should be unique
assert len(set(statement.statement_id for statement in statements)) == statements_len
# a root statement and all case statement
assert statements_len == len(testcases) * 2 + 1
def test_exception_outside_case(self):
info = "Grading Exception!!!!"
......
......@@ -8,16 +8,17 @@ import os
class ProjectTest(unittest.TestCase):
def test_all(self):
# 构建
shutil.rmtree("../build", ignore_errors=True)
shutil.rmtree("../dist", ignore_errors=True)
shutil.rmtree("../pygrading.egg-info", ignore_errors=True)
self.assertEqual(os.path.exists("../build"), False)
self.assertEqual(os.path.exists("../dist"), False)
self.assertEqual(os.path.exists("pygrading.edd-info"), False)
os.system("cd .. && python setup.py sdist bdist_wheel")
whls = [x for x in os.listdir("../dist") if x[-4:] == ".whl"]
project_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
shutil.rmtree(os.path.join(project_path, "build"), ignore_errors=True)
shutil.rmtree(os.path.join(project_path, "dist"), ignore_errors=True)
shutil.rmtree(os.path.join(project_path, "pygrading.egg-info"), ignore_errors=True)
self.assertEqual(os.path.exists(os.path.join(project_path, "build")), False)
self.assertEqual(os.path.exists(os.path.join(project_path, "dist")), False)
self.assertEqual(os.path.exists(os.path.join(project_path, "pygrading.egg-info")), False)
os.system(f"cd {project_path} && python setup.py sdist bdist_wheel")
whls = [x for x in os.listdir(os.path.join(project_path, "dist")) if x[-4:] == ".whl"]
self.assertEqual(len(whls), 1)
whl_path = os.path.join(os.getcwd(), "../dist", whls[0])
whl_path = os.path.join(os.getcwd(), os.path.join(project_path, "dist"), whls[0])
# 创建虚拟环境
os.system("python -m venv --clear env")
python = os.path.join("env", "Scripts", "python")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment