2020-07-09 18:33:16 +02:00
|
|
|
import unittest
|
2020-09-02 20:26:12 +02:00
|
|
|
from unittest import mock
|
2020-07-09 18:33:16 +02:00
|
|
|
|
|
|
|
from scripts.lib.hash_reqs import expand_reqs, hash_deps
|
|
|
|
from tools.setup.setup_venvs import DEV_REQS_FILE
|
|
|
|
|
|
|
|
|
|
|
|
class TestHashCreation(unittest.TestCase):
|
|
|
|
def test_diff_hash_for_diff_python_version(self) -> None:
|
2021-02-12 08:20:45 +01:00
|
|
|
with mock.patch("scripts.lib.hash_reqs.python_version", return_value="Python 3.6.9"):
|
2020-07-09 18:33:16 +02:00
|
|
|
deps = expand_reqs(DEV_REQS_FILE)
|
|
|
|
hash1 = hash_deps(deps)
|
|
|
|
|
2021-02-12 08:20:45 +01:00
|
|
|
with mock.patch("scripts.lib.hash_reqs.python_version", return_value="Python 3.6.9"):
|
2020-07-09 18:33:16 +02:00
|
|
|
deps = expand_reqs(DEV_REQS_FILE)
|
|
|
|
hash2 = hash_deps(deps)
|
|
|
|
|
2021-02-12 08:20:45 +01:00
|
|
|
with mock.patch("scripts.lib.hash_reqs.python_version", return_value="Python 3.8.2"):
|
2020-07-09 18:33:16 +02:00
|
|
|
deps = expand_reqs(DEV_REQS_FILE)
|
|
|
|
hash3 = hash_deps(deps)
|
|
|
|
|
|
|
|
assert hash1 == hash2
|
|
|
|
assert hash1 != hash3
|