0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/buildscripts/tests/test_packager.py
Steve McClure b4b23946cd SERVER-90570: Enable formatting checks for buildscripts directory, excluding idl (#22254)
GitOrigin-RevId: 9d997a9f44cd43a8dec7c2a17fa2dbcd875e92f6
2024-05-16 22:07:36 +00:00

50 lines
1.2 KiB
Python

"""Unit tests for the packager script."""
from dataclasses import dataclass
from unittest import TestCase
from buildscripts.packager import Spec
class TestPackager(TestCase):
"""Test packager.py."""
def test_is_nightly(self) -> None:
"""Test is_nightly."""
@dataclass
class Case:
"""Test case data."""
name: str
version: str
want: bool
cases = [
Case(
name="Waterfall alpha",
version="5.3.0-alpha-211-g546d77f",
want=True,
),
Case(
name="Waterfall",
version="5.3.0-211-g546d77f",
want=True,
),
Case(
name="Mainline",
version="5.3.0",
want=False,
),
Case(
name="Release candidate",
version="5.3.0-rc0",
want=False,
),
]
for case in cases:
with self.subTest(name=case.name):
spec = Spec(ver=case.version)
self.assertEqual(spec.is_nightly(), case.want)