test: Checks if the pyproject.toml and __version__ in __init__.py are in sync

This commit is contained in:
debugtalk
2022-04-20 14:14:59 +08:00
parent 67d37c0605
commit f7f0c5d2cf

View File

@@ -2,12 +2,12 @@ import decimal
import json
import os
import unittest
from pathlib import Path
from httprunner import loader, utils
from httprunner.utils import (
ExtendJSONEncoder,
merge_variables,
)
import toml
from httprunner import __version__, loader, utils
from httprunner.utils import ExtendJSONEncoder, merge_variables
class TestUtils(unittest.TestCase):
@@ -152,3 +152,11 @@ class TestUtils(unittest.TestCase):
parameters_content_list = []
product_list = utils.gen_cartesian_product(*parameters_content_list)
self.assertEqual(product_list, [])
def test_versions_are_in_sync(self):
"""Checks if the pyproject.toml and __version__ in __init__.py are in sync."""
path = Path(__file__).resolve().parents[1] / "pyproject.toml"
pyproject = toml.loads(open(str(path)).read())
pyproject_version = pyproject["tool"]["poetry"]["version"]
self.assertEqual(pyproject_version, __version__)