Explicitly disable ttyrec recording in tests to avoid polluting the directory in which tests are run#105
Explicitly disable ttyrec recording in tests to avoid polluting the directory in which tests are run#105jbcoe wants to merge 2 commits intoNetHack-LE:mainfrom
Conversation
|
I've just ignored the file so far! |
|
If this is know about, I'll consider my investigation complete. I don't think that running tests should need write access to the working directory, this PR fixes that. |
|
As a principle, I prefer to have the tests clean up any files that are created as part of the normal run rather than have the test modify the code like that. What do you think? |
|
We could explicitly supply I'm not too fond of the monkey-patching as it's brittle. Ideally Nethack instances would not write to disk by default but that feels like a larger change. |
|
I'd prefer the We could also some new tests to explicitly create a named ttyrec file and the default one to check that it continues to work, and have those tests clean up after themselves. I think creating a ttyrec is a really important feature though. Imagine getting an agent to ascend and not having a recording of it! 😱 |
StephenOman
left a comment
There was a problem hiding this comment.
The other tests (test_envs.py, test_tiles.py etc.) also create the nle.ttyrec3.bz2 output file, so perhaps should be updated too for completeness.
| with pytest.raises(IOError): | ||
| nethack.Nethack(ttyrec="") | ||
| game = nethack.Nethack() | ||
| game = nethack.Nethack(ttyrec=None) |
There was a problem hiding this comment.
This test shouldn't have the ttyrec override as it's testing an incorrect filename.
|
Given the somewhat error prone manual nature of this fix, I'm keen to find a cleaner approach. I'll ponder. |
Before this change, a file (
nle.ttyrec3.bz2) is written to the project root when tests are run. I'm curious as to why we've not spotted this before.Investigation in progress so leaving this as a draft for now.