Draft
Conversation
Collaborator
Author
|
问题来了 test 怎么写 |
Contributor
|
在 Windows 下的一个 Bug: 总之重定向到 stdout 的行为没有成功,大概是因为 |
Collaborator
Author
windows 怎么这么不牛 只能走临时文件了 |
Collaborator
Author
|
@weilycoder 没环境 你再试试 |
Contributor
|
我认为我有必要先描述我的测试方法,以便后续讨论:
|
Contributor
|
那么,现在有一个奇怪的行为: cyaron/cyaron/graders/testlib_checker.py Lines 33 to 36 in f82ae64 如果直接跑测试,报错(临时文件名可能不同): 将 34 行加上 继续在 35 行加上 在 33 行加上 |
Contributor
|
然后如果改成这样,行为看起来就很对: with tempfile.TemporaryDirectory() as checker_output_dir, \
open(path_join(checker_output_dir, 'input.txt'), 'w', newline='\n') as inf, \
open(path_join(checker_output_dir, 'output.txt'), 'w', newline='\n') as outf, \
open(path_join(checker_output_dir, 'answer.txt'), 'w', newline='\n') as ansf:
...并且如果出现错误可能报错信息也更可读(临时文件见名知意)。 |
Collaborator
Author
|
所以是windows在关闭文件之前不会立即写入??? |
Contributor
|
鬼知道啥行为? 我只是把 |
2f520f5 to
7056a5a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.