【发布时间】:2018-03-19 16:11:48
【问题描述】:
我在 os.getcwd() 上收到 FileNotFoundError
def setUp(self):
try:
self.previous_dir=os.getcwd()
except:
print("no file?")
try:
self.test_dir.mkdir(parents=True, exist_ok=True)
os.chdir(self.test_dir)
self.logger.debug(f'CDed to {self.test_dir}')
except (IOError, TypeError) as ioe:
self.logger.error(f'Unable to make or CD to {self.test_dir}')
sys.exit(1)
我在 tearDown() 中 cd 回 self.previous_dir 并删除临时目录。
它是否试图访问已删除的文件?
【问题讨论】:
-
你能添加完整的回溯吗?
-
这可能是重复的,但我认为它更清楚。
标签: python python-3.x python-unittest