Skip to content

Commit

Permalink
Fix version CLI showing 0.0.0 (#2305)
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
gaborbernat authored Feb 6, 2025
1 parent 94c21e6 commit 2eac729
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 104 deletions.
4 changes: 2 additions & 2 deletions datamodel_code_generator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ def main(args: Optional[Sequence[str]] = None) -> Exit:
arg_parser.parse_args(args, namespace=namespace)

if namespace.version:
from datamodel_code_generator.version import version
from datamodel_code_generator import get_version

print(version)
print(get_version())
exit(0)

pyproject_config = _get_pyproject_toml_config(Path().resolve())
Expand Down
1 change: 0 additions & 1 deletion datamodel_code_generator/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/main/jsonschema/test_main_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,7 @@ def test_version(capsys):
main(['--version'])
assert e.value.code == Exit.OK
captured = capsys.readouterr()
assert captured.out == '0.0.0\n'
assert captured.out != '0.0.0\n'
assert captured.err == ''


Expand Down
Loading

0 comments on commit 2eac729

Please sign in to comment.