-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) 2021, GeoVista Contributors. | ||
# | ||
# This file is part of GeoVista and is distributed under the 3-Clause BSD license. | ||
# See the LICENSE file in the package root directory for licensing details. | ||
|
||
"""Unit-tests for :func:`geovista.common.get_modules`.""" | ||
from __future__ import annotations | ||
|
||
import importlib | ||
from os import sep | ||
from pathlib import Path | ||
|
||
from geovista.common import get_modules | ||
|
||
|
||
def test_package_walk(): | ||
"""Test walk of examples package for all underlying example modules.""" | ||
package = "geovista.examples" | ||
result = get_modules(package) | ||
|
||
module = importlib.import_module(package) | ||
path = Path(module.__path__[0]) | ||
fnames = path.rglob("*.py") | ||
expected = [ | ||
str(fname.relative_to(path)).replace(".py", "").replace(sep, ".") | ||
for fname in fnames | ||
if fname.name != "__init__.py" | ||
] | ||
|
||
assert result == sorted(expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters