summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorAanand Prasad <aanand.prasad@gmail.com>2015-08-26 16:07:12 +0100
committerAanand Prasad <aanand.prasad@gmail.com>2015-08-26 19:14:09 +0100
commit20e142fe7878800830acb216625487145e4a1d96 (patch)
treef0b64974e83897821bb9bd5ff8017be0b2ce700e /tests/helpers.py
parentd60cb3172e767d77cb55c8b183ac0f7cea658d5f (diff)
downloaddocker-py-20e142fe7878800830acb216625487145e4a1d96.tar.gz
Better support for .dockerignore
- Support all basic pattern forms: file, directory, *, ?, ! - Fix handling of wildcard patterns and subdirectories - `*/a.py` should match `foo/a.py`, but not `foo/bar/a.py` - Fix handling of directory patterns with a trailing slash - make sure they're handled equivalently to those without one - Fix handling of custom Dockerfiles - make sure they go in the tarball Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
new file mode 100644
index 0000000..95692db
--- /dev/null
+++ b/tests/helpers.py
@@ -0,0 +1,16 @@
+import os
+import os.path
+import tempfile
+
+
+def make_tree(dirs, files):
+ base = tempfile.mkdtemp()
+
+ for path in dirs:
+ os.makedirs(os.path.join(base, path))
+
+ for path in files:
+ with open(os.path.join(base, path), 'w') as f:
+ f.write("content")
+
+ return base