Skip to content

Commit 4f81da0

Browse files
authored
Only warn deprecation when relevant (#68)
* Only warn deprecation when relevant * Bump version v7.0.1 -> v7.0.2
1 parent 3567368 commit 4f81da0

File tree

6 files changed

+62
-34
lines changed

6 files changed

+62
-34
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from . import (
22
all_optional,
3-
model, # For backwards compatibility
43
required,
54
)
65

7-
__all__ = ["model", "all_optional", "required"]
6+
__all__ = ["all_optional", "required"]

generated/python/datadoc_model/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ssb-datadoc-model"
3-
version = "7.0.1"
3+
version = "7.0.2"
44
description = "Data Model for use in Statistics Norway's Metadata system"
55
authors = [{ name = "Statistics Norway", email = "metadata@ssb.no" }]
66
license = "MIT"

generated/python/datadoc_model/tests/test_datadoc_model_all_optional.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import pytest
2-
from datadoc_model.model import (
2+
from pydantic import ValidationError
3+
4+
from datadoc_model.all_optional.model import (
35
DatadocMetadata,
46
MetadataContainer,
57
)
6-
from pydantic import ValidationError
78

89

910
def test_instantiate_no_values_container():

generated/python/datadoc_model/tests/test_datadoc_model.py renamed to generated/python/datadoc_model/tests/test_deprecated_datadoc_model.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
"""These tests go against the original import path which is now deprecated
2+
and should be removed in the next major release.
3+
4+
Potentially some of the tests can be retained and moved to other test modules
5+
if they still provide value.
6+
"""
7+
18
import pytest
2-
from datadoc_model.model import (
3-
DatadocMetadata,
4-
MetadataContainer
5-
)
69
from pydantic import ValidationError
710

11+
from datadoc_model.model import DatadocMetadata, MetadataContainer
12+
813

914
def test_instantiate_no_values_container():
1015
container = MetadataContainer()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import importlib
2+
3+
import pytest
4+
5+
import datadoc_model.all_optional # noqa: F401
6+
import datadoc_model.model
7+
import datadoc_model.required # noqa: F401
8+
9+
10+
def test_import_deprecated_module():
11+
with pytest.warns(DeprecationWarning):
12+
importlib.reload(datadoc_model.model)
13+
14+
15+
def test_import_all_optional_module(recwarn):
16+
importlib.reload(datadoc_model.all_optional)
17+
18+
assert len(recwarn) == 0
19+
20+
21+
def test_import_required_module(recwarn):
22+
importlib.reload(datadoc_model.required)
23+
assert len(recwarn) == 0

generated/python/datadoc_model/uv.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)