summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorgan Goose <morgan.goose@plangrid.com>2016-03-26 12:31:04 -0700
committerMorgan Goose <morgan.goose@plangrid.com>2016-03-26 12:31:04 -0700
commit1479ee55fa80196d914c1e683f2c379edb9a8a0a (patch)
tree85f230a45b1d1f7654642606b8b4141bd7bdd722
parentc66d21dca0420b855d52e8639e107af039710a7e (diff)
downloadpycco-1479ee55fa80196d914c1e683f2c379edb9a8a0a.tar.gz
Including a test for _flatten_sources
-rw-r--r--tests/test_pycco.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_pycco.py b/tests/test_pycco.py
index 02ef008..ae7d0e4 100644
--- a/tests/test_pycco.py
+++ b/tests/test_pycco.py
@@ -161,3 +161,25 @@ def test_generate_index(path_lists, outdir_list):
file_paths = [os.path.join(*path_list) for path_list in path_lists]
outdir = os.path.join(*outdir_list)
generate_index.generate_index(file_paths, outdir=outdir)
+
+def test_flatten_sources(tmpdir):
+ sources = [str(tmpdir)]
+ expected_sources = []
+
+ # Setup the base dir
+ td = tmpdir.join("test.py")
+ td.write("#!/bin/env python")
+ expected_sources.append(str(td))
+
+ # Make some more directories, each with a file present
+ for d in ["foo", "bar", "buzz"]:
+ dd = tmpdir.mkdir(d)
+ dummy_file = dd.join("test.py")
+ dummy_file.write("#!/bin/env python")
+ expected_sources.append(str(dummy_file))
+
+ # Get the flattened version of the base directory
+ flattened = p._flatten_sources(sources)
+
+ # Make sure that the lists are the same
+ assert sorted(expected_sources) == sorted(flattened)