annotate tests/test_path.py @ 18:56596902e9ae default tip

add some setup + tests
author Jeff Hammel <k0scist@gmail.com>
date Sun, 10 Dec 2017 17:57:03 -0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 import os
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 from lemuriformes.path import TempDir
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 def test_tempdir_contextmanager():
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 """
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 ensure our temporary directory contextmanager works
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 and does what we want it to
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 """
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 tmpdir = None
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 with TempDir() as td:
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 tmpdir = td
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 assert os.path.exists(tmpdir)
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 assert os.path.isdir(tmpdir)
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 assert not os.path.exists(tmpdir)
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 assert not os.path.isdir(tmpdir)
56596902e9ae add some setup + tests
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18