mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 06:28:23 +00:00
Fixes #12868. We now also include python version in the format 'major.minor.patchlevel', when generating hash for a requirement file. This was necessary since packages tend to break on different versions of python, so it is important to track the version on which the venv was setup. WARN: This commit will force all zulip venvs to be recreated.
26 lines
836 B
Python
26 lines
836 B
Python
import unittest
|
|
|
|
import mock
|
|
|
|
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:
|
|
with mock.patch('scripts.lib.hash_reqs.python_version', return_value='Python 3.6.9'):
|
|
deps = expand_reqs(DEV_REQS_FILE)
|
|
hash1 = hash_deps(deps)
|
|
|
|
with mock.patch('scripts.lib.hash_reqs.python_version', return_value='Python 3.6.9'):
|
|
deps = expand_reqs(DEV_REQS_FILE)
|
|
hash2 = hash_deps(deps)
|
|
|
|
with mock.patch('scripts.lib.hash_reqs.python_version', return_value='Python 3.8.2'):
|
|
deps = expand_reqs(DEV_REQS_FILE)
|
|
hash3 = hash_deps(deps)
|
|
|
|
assert hash1 == hash2
|
|
assert hash1 != hash3
|