(release) Prepare 1.0.0 release metadata
Add the initial 1.0.0 changelog, bump the package/application version, and expose the release version through `pobsync --version`. Cover the version output in the console entrypoint tests.
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
__all__ = ["__version__"]
|
||||
__version__ = "0.1.0"
|
||||
|
||||
__version__ = "1.0.0"
|
||||
|
||||
@@ -6,6 +6,8 @@ from typing import Sequence
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
from pobsync import __version__
|
||||
|
||||
|
||||
COMMAND_ALIASES = {
|
||||
"backup": "run_pobsync_backup",
|
||||
@@ -34,6 +36,9 @@ Configuration is managed from the Django control panel. Use
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
args = list(sys.argv[1:] if argv is None else argv)
|
||||
if args and args[0] in {"--version", "version"}:
|
||||
print(f"pobsync {__version__}")
|
||||
return 0
|
||||
if not args or args[0] in {"-h", "--help", "help"}:
|
||||
print(_usage())
|
||||
return 0
|
||||
|
||||
@@ -9,6 +9,14 @@ from pobsync.cli import main
|
||||
|
||||
|
||||
class ConsoleEntrypointTests(SimpleTestCase):
|
||||
def test_version_prints_package_version(self) -> None:
|
||||
stdout = StringIO()
|
||||
with patch("sys.stdout", stdout):
|
||||
exit_code = main(["--version"])
|
||||
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertEqual(stdout.getvalue().strip(), "pobsync 1.0.0")
|
||||
|
||||
def test_maps_backup_alias_to_django_command(self) -> None:
|
||||
with patch("pobsync.cli.execute_from_command_line") as execute:
|
||||
exit_code = main(["backup", "web-01", "--dry-run"])
|
||||
|
||||
Reference in New Issue
Block a user