Skip to content

Commit

Permalink
Remove duplicate version info (#1608)
Browse files Browse the repository at this point in the history
* Remove duplicate version info

* freeze package name to tortoise-orm

* fix missing assert

* fix Codacy Static Code Analysis issues

* fix lint error
  • Loading branch information
waketzheng committed May 14, 2024
1 parent d7c59dc commit 9053fa7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sys
from pathlib import Path

from tortoise import __version__

if sys.version_info >= (3, 11):
import tomllib
else:
import tomlkit as tomllib


def _read_version():
text = Path("pyproject.toml").read_text()
data = tomllib.loads(text)
return data["tool"]["poetry"]["version"]


def test_version():
assert _read_version() == __version__
3 changes: 2 additions & 1 deletion tortoise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import importlib
import importlib.metadata as importlib_metadata
import json
import os
import warnings
Expand Down Expand Up @@ -690,7 +691,7 @@ async def do_stuff():
loop.run_until_complete(connections.close_all(discard=True))


__version__ = "0.20.1"
__version__ = importlib_metadata.version("tortoise-orm")

__all__ = [
"Model",
Expand Down

0 comments on commit 9053fa7

Please sign in to comment.