diff --git a/tests/python/pypackagecomplex/complex/subpackage/__init__.py b/tests/python/pypackagecomplex/complex/subpackage/__init__.py index d4bdba7..5c90deb 100644 --- a/tests/python/pypackagecomplex/complex/subpackage/__init__.py +++ b/tests/python/pypackagecomplex/complex/subpackage/__init__.py @@ -5,6 +5,3 @@ from .submodule import public_multiple_imports def module_level_method(foo, bar): """A module level method""" pass -def module_level_method(foo, bar): - """A module level method""" - pass diff --git a/tests/python/pypackagecomplex/complex/subpackage/submodule.py b/tests/python/pypackagecomplex/complex/subpackage/submodule.py index c074c84..eeefb3f 100644 --- a/tests/python/pypackagecomplex/complex/subpackage/submodule.py +++ b/tests/python/pypackagecomplex/complex/subpackage/submodule.py @@ -1,5 +1,5 @@ def public_chain(): - """Part of a resolution chain.""" + """Part of a public resolution chain.""" return 5 def _private_made_public(): @@ -8,4 +8,4 @@ def _private_made_public(): def public_multiple_imports(): """A public function imported in multiple places.""" - return 5 \ No newline at end of file + return 5 diff --git a/tests/python/pypackagecomplex/complex/wildcard/__init__.py b/tests/python/pypackagecomplex/complex/wildcard/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/python/pypackagecomplex/complex/wildcard/chain.py b/tests/python/pypackagecomplex/complex/wildcard/chain.py new file mode 100644 index 0000000..9f43876 --- /dev/null +++ b/tests/python/pypackagecomplex/complex/wildcard/chain.py @@ -0,0 +1,2 @@ +from .simple import module_level_method +from .simple import public_chain diff --git a/tests/python/pypackagecomplex/complex/wildcard/simple.py b/tests/python/pypackagecomplex/complex/wildcard/simple.py new file mode 100644 index 0000000..64eea5a --- /dev/null +++ b/tests/python/pypackagecomplex/complex/wildcard/simple.py @@ -0,0 +1 @@ +from ..subpackage import * diff --git a/tests/python/pypackagecomplex/index.rst b/tests/python/pypackagecomplex/index.rst index a4c6a2c..272a9fa 100644 --- a/tests/python/pypackagecomplex/index.rst +++ b/tests/python/pypackagecomplex/index.rst @@ -1,10 +1,10 @@ -.. pypackageexample documentation master file, created by +.. pypackagecomplex documentation master file, created by sphinx-quickstart on Fri May 29 13:34:37 2015. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to pypackageexample's documentation! -===================================== +Welcome to pypackagecomplex's documentation! +============================================ .. toctree:: diff --git a/tests/python/test_pyintegration.py b/tests/python/test_pyintegration.py index fd0bacd..a4287a8 100644 --- a/tests/python/test_pyintegration.py +++ b/tests/python/test_pyintegration.py @@ -121,7 +121,7 @@ class TestSimplePackage(object): def built(self, builder): builder('pypackageexample') - def test_integration_with_package(self, builder): + def test_integration_with_package(self): example_path = '_build/text/autoapi/example/index.txt' with io.open(example_path, encoding='utf8') as example_handle: @@ -198,3 +198,75 @@ def test_hiding_private_members(builder): private_file = private_handle.read() assert 'public_method' in private_file + + +class TestComplexPackage(object): + + @pytest.fixture(autouse=True, scope='class') + def built(self, builder): + builder('pypackagecomplex') + + def test_public_chain_resolves(self): + submodule_path = '_build/text/autoapi/complex/subpackage/submodule/index.txt' + with io.open(submodule_path, encoding='utf8') as submodule_handle: + submodule_file = submodule_handle.read() + + assert "Part of a public resolution chain." in submodule_file + + subpackage_path = '_build/text/autoapi/complex/subpackage/index.txt' + with io.open(subpackage_path, encoding='utf8') as subpackage_handle: + subpackage_file = subpackage_handle.read() + + assert "Part of a public resolution chain." in subpackage_file + + package_path = '_build/text/autoapi/complex/index.txt' + with io.open(package_path, encoding='utf8') as package_handle: + package_file = package_handle.read() + + assert "Part of a public resolution chain." in package_file + + def test_private_made_public(self): + submodule_path = '_build/text/autoapi/complex/subpackage/submodule/index.txt' + with io.open(submodule_path, encoding='utf8') as submodule_handle: + submodule_file = submodule_handle.read() + + assert "A private function made public by import." in submodule_file + + def test_multiple_import_locations(self): + submodule_path = '_build/text/autoapi/complex/subpackage/submodule/index.txt' + with io.open(submodule_path, encoding='utf8') as submodule_handle: + submodule_file = submodule_handle.read() + + assert "A public function imported in multiple places." in submodule_file + + subpackage_path = '_build/text/autoapi/complex/subpackage/index.txt' + with io.open(subpackage_path, encoding='utf8') as subpackage_handle: + subpackage_file = subpackage_handle.read() + + assert "A public function imported in multiple places." in subpackage_file + + package_path = '_build/text/autoapi/complex/index.txt' + with io.open(package_path, encoding='utf8') as package_handle: + package_file = package_handle.read() + + assert "A public function imported in multiple places." in package_file + + @pytest.mark.xfail(reason="Not yet implemented") + def test_simple_wildcard_imports(self): + wildcard_path = '_build/text/autoapi/complex/wildcard/simple/index.txt' + with io.open(wildcard_path, encoding='utf8') as wildcard_handle: + wildcard_file = wildcard_handle.read() + + assert "public_chain" in wildcard_file + assert "now_public_function" in wildcard_file + assert "public_multiple_imports" in wildcard_file + assert "module_level_method" in wildcard_file + + @pytest.mark.xfail(reason="Not yet implemented") + def test_wildcard_chain(self): + wildcard_path = '_build/text/autoapi/complex/wildcard/chain/index.txt' + with io.open(wildcard_path, encoding='utf8') as wildcard_handle: + wildcard_file = wildcard_handle.read() + + assert "public_chain" in wildcard_file + assert "module_level_method" in wildcard_file