|
8 | 8 | import pytest |
9 | 9 | from jsonschema import ValidationError, validate |
10 | 10 |
|
11 | | -from griffe import Attribute, Class, Function, GriffeLoader, Kind, Module, Object, temporary_visited_module |
12 | | -from griffe._internal.tests import temporary_pypackage |
| 11 | +from griffe import ( |
| 12 | + Attribute, |
| 13 | + Class, |
| 14 | + Function, |
| 15 | + GriffeLoader, |
| 16 | + Kind, |
| 17 | + Module, |
| 18 | + Object, |
| 19 | + temporary_inspected_package, |
| 20 | + temporary_visited_module, |
| 21 | +) |
13 | 22 |
|
14 | 23 |
|
15 | 24 | def test_minimal_data_is_enough() -> None: |
@@ -41,18 +50,11 @@ def test_namespace_packages() -> None: |
41 | 50 |
|
42 | 51 | Namespace packages are a bit special as they have no `__init__.py` file. |
43 | 52 | """ |
44 | | - with temporary_pypackage("namespace_package", init=False) as pkg: |
45 | | - loader = GriffeLoader() |
46 | | - module = loader.load(pkg.path) |
| 53 | + with temporary_inspected_package("namespace_package", init=False) as pkg: |
47 | 54 | dump_options = {"indent": 2, "sort_keys": True} |
48 | | - assert module.filepath == [pkg.path] |
49 | | - minimal = module.as_json(full=False, **dump_options) |
50 | | - full = module.as_json(full=True, **dump_options) |
51 | | - reloaded = Module.from_json(minimal) |
52 | | - assert reloaded.as_json(full=False, **dump_options) == minimal |
| 55 | + full = pkg.as_json(full=True, **dump_options) |
| 56 | + reloaded = Object.from_json(full) |
53 | 57 | assert reloaded.as_json(full=True, **dump_options) == full |
54 | | - assert Object.from_json(minimal) |
55 | | - assert Object.from_json(full) |
56 | 58 |
|
57 | 59 |
|
58 | 60 | @pytest.mark.parametrize( |
|
0 commit comments