@@ -763,26 +763,27 @@ def test_namespace_initialization(self):
763
763
This tests the :func:`~py2deb.hooks.initialize_namespaces()` and
764
764
:func:`~py2deb.hooks.cleanup_namespaces()` functions.
765
765
"""
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' ))
786
787
787
788
def test_pkgutil_namespaces (self ):
788
789
"""
0 commit comments