Skip to content

Commit 52f39ec

Browse files
committed
Fix test broken in f6ad9ee
1 parent 8996d37 commit 52f39ec

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

py2deb/tests.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -763,26 +763,27 @@ def test_namespace_initialization(self):
763763
This tests the :func:`~py2deb.hooks.initialize_namespaces()` and
764764
:func:`~py2deb.hooks.cleanup_namespaces()` functions.
765765
"""
766-
with TemporaryDirectory() as directory:
767-
package_name = 'namespace-package-test'
768-
initialize_namespaces(package_name, directory, TEST_NAMESPACES)
769-
self.check_test_namespaces(directory)
770-
# Increase the reference count of the top level name space.
771-
initialize_namespaces(package_name, directory, set([('foo',)]))
772-
self.check_test_namespaces(directory)
773-
# Clean up the nested name spaces.
774-
cleanup_namespaces(package_name, directory, TEST_NAMESPACES)
775-
# Make sure top level name space is still intact.
776-
assert os.path.isdir(os.path.join(directory, 'foo'))
777-
assert os.path.isfile(os.path.join(directory, 'foo', '__init__.py'))
778-
# Make sure the nested name spaces were cleaned up.
779-
assert not os.path.isdir(os.path.join(directory, 'foo', 'bar'))
780-
assert not os.path.isfile(os.path.join(directory, 'foo', 'bar', '__init__.py'))
781-
assert not os.path.isdir(os.path.join(directory, 'foo', 'bar', 'baz'))
782-
assert not os.path.isfile(os.path.join(directory, 'foo', 'bar', 'baz', '__init__.py'))
783-
# Clean up the top level name space as well.
784-
cleanup_namespaces(package_name, directory, TEST_NAMESPACES)
785-
assert not os.path.isdir(os.path.join(directory, 'foo'))
766+
for namespace_style in 'setuptools', 'pkgutil', 'none':
767+
with TemporaryDirectory() as directory:
768+
package_name = 'namespace-package-test'
769+
initialize_namespaces(package_name, directory, TEST_NAMESPACES, namespace_style)
770+
self.check_test_namespaces(directory)
771+
# Increase the reference count of the top level name space.
772+
initialize_namespaces(package_name, directory, set([('foo',)]), namespace_style)
773+
self.check_test_namespaces(directory)
774+
# Clean up the nested name spaces.
775+
cleanup_namespaces(package_name, directory, TEST_NAMESPACES)
776+
# Make sure top level name space is still intact.
777+
assert os.path.isdir(os.path.join(directory, 'foo'))
778+
assert os.path.isfile(os.path.join(directory, 'foo', '__init__.py'))
779+
# Make sure the nested name spaces were cleaned up.
780+
assert not os.path.isdir(os.path.join(directory, 'foo', 'bar'))
781+
assert not os.path.isfile(os.path.join(directory, 'foo', 'bar', '__init__.py'))
782+
assert not os.path.isdir(os.path.join(directory, 'foo', 'bar', 'baz'))
783+
assert not os.path.isfile(os.path.join(directory, 'foo', 'bar', 'baz', '__init__.py'))
784+
# Clean up the top level name space as well.
785+
cleanup_namespaces(package_name, directory, TEST_NAMESPACES)
786+
assert not os.path.isdir(os.path.join(directory, 'foo'))
786787

787788
def test_pkgutil_namespaces(self):
788789
"""

0 commit comments

Comments
 (0)