StepfenShawn / Cantonese

粤语編程語言.The Cantonese programming language.
https://cantonese-community.github.io/
MIT License
1.15k stars 46 forks source link

#41 自动测试搭建, 第一批四个用例 #42

Closed nobodxbodon closed 3 years ago

nobodxbodon commented 3 years ago

获取进程输出,与期望值作比较。 主要是搭起测试架子,后续可添加更多用例。 在 mac 测试通过:在 src 下运行 python -m unittest 测试.py。请在 windows 下测试看是否通过?

StepfenShawn commented 3 years ago

Windows下好像不可以:

PS C:\Users\Administrator\Desktop\Cantonese\src> python -m unittest 测试.py
E
======================================================================
ERROR: test (测试.test所有)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\Cantonese\src\测试.py", line 16, in test
    实际值 = 运行代码(路径)
  File "C:\Users\Administrator\Desktop\Cantonese\src\运行.py", line 13, in 运行代码
    return subprocess.Popen(参数, stdout=subprocess.PIPE).communicate()[0]
  File "F:\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "F:\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

----------------------------------------------------------------------
Ran 1 test in 0.005s

FAILED (errors=1)
StepfenShawn commented 3 years ago

没事,我再改一下

StepfenShawn commented 3 years ago

改好了, Windows下可以通过测试了, 谢谢你的PR!