Last active
December 5, 2021 23:24
-
-
Save tos-kamiya/5c79ef72572562775fd3773b5cc217c4 to your computer and use it in GitHub Desktop.
os.chdir in unittest's test case causes a RecursionError on Windows 10
This file contains 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
import unittest | |
import os | |
import tempfile | |
class ChdirTest(unittest.TestCase): | |
def test_chdir(self): | |
with tempfile.TemporaryDirectory() as tempdir: | |
os.chdir(tempdir) # this results in remvoing the current directory, so causes an error on Windows | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment