summaryrefslogtreecommitdiff
path: root/tests/test_wheelfile.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2019-04-28 10:14:46 -0400
committerAlex Grönholm <alex.gronholm@nextday.fi>2019-04-28 17:14:46 +0300
commit369b1eeb05f1ce55363afd80edda446a4155d952 (patch)
tree1d6af8270ac87a73a45c16db7c8d22cbca2ce1cf /tests/test_wheelfile.py
parent4fddbbaa0e7fab4ecfaab066e4cf2558b6c13dd8 (diff)
downloadwheel-git-369b1eeb05f1ce55363afd80edda446a4155d952.tar.gz
Include directory entries when building wheel (#289)
Fixes #287.
Diffstat (limited to 'tests/test_wheelfile.py')
-rw-r--r--tests/test_wheelfile.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_wheelfile.py b/tests/test_wheelfile.py
index db11bcd..9fe3ce2 100644
--- a/tests/test_wheelfile.py
+++ b/tests/test_wheelfile.py
@@ -2,6 +2,7 @@
from __future__ import unicode_literals
import sys
+import operator
from zipfile import ZipFile, ZIP_DEFLATED
import pytest
@@ -172,3 +173,26 @@ def test_attributes(tmpdir_factory, wheel_path):
info = zf.getinfo('test-1.0.dist-info/RECORD')
permissions = (info.external_attr >> 16) & 0o777
assert permissions == 0o664
+
+
+def test_directories(tmpdir, wheel_path):
+ """
+ The WheelFile should contain entries for directories,
+ empty and not.
+ """
+ build_dir = tmpdir
+ sub_dir = build_dir / 'sub'
+ sub_dir.mkdir()
+ (sub_dir / '__init__.py').write_text('', encoding='utf-8')
+ empty_dir = build_dir / 'empty'
+ empty_dir.mkdir()
+
+ with WheelFile(wheel_path, 'w') as wf:
+ wf.write_files(str(build_dir))
+
+ with ZipFile(wheel_path, 'r') as zf:
+ infos = zf.infolist()
+
+ names = set(map(operator.attrgetter('filename'), infos))
+ assert 'sub/' in names
+ assert 'empty/' in names