Skip to content
Snippets Groups Projects
Commit 38956814 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Unit tests for tempdir module

parent 9407da2c
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
#
# test_tempdir.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import os
import os.path as op
import fsl.utils.tempdir as tempdir
def test_tempdir():
# use ctx manager with or without arg
with tempdir.tempdir():
d = os.getcwd()
# dir is removed after ctx manager exit
assert not op.exists(d)
with tempdir.tempdir() as td:
d = td
assert op.exists(d)
# pwd is dir when in ctx manager
assert op.realpath(os.getcwd()) == op.realpath(td)
assert not op.exists(d)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment