Remove computing of artificial hashes for binaries in test mode

GitOrigin-RevId: 7d3f61e173ded71f922bd64022397dadceda2281
This commit is contained in:
Mikhail Golubev
2019-06-10 19:42:54 +03:00
committed by intellij-monorepo-bot
parent 48b38b34ed
commit 96174f9a0f
3 changed files with 3 additions and 17 deletions
+1 -8
View File
@@ -354,14 +354,7 @@ def build_cache_dir_path(subdir, mod_qname, mod_path):
def module_hash(mod_qname, mod_path):
# Hash the content of a physical module
if mod_path:
if os.environ.get(ENV_CONTENT_INDEPENDENT_HASHES_FLAG) == 'True':
prefix = 'sha256:' + mod_qname
version = getattr(__import__(mod_qname), '__version__', None)
if version:
return prefix + ':' + version
return prefix
else:
return physical_module_hash(mod_path)
return physical_module_hash(mod_path)
else:
return builtin_module_hash(mod_qname)
@@ -810,7 +810,6 @@ REQUIRED_VERSION_LINE = re.compile(r'(?P<name>\S+)\s+(?P<version>\d+\.\d+)')
BLACKLIST_VERSION_LINE = re.compile(r'(?P<path>[^=]+) = (?P<version>\d+\.\d+) (?P<mtime>\d+)')
ENV_TEST_MODE_FLAG = 'GENERATOR3_TEST_MODE'
ENV_CONTENT_INDEPENDENT_HASHES_FLAG = 'GENERATOR3_CONTENT_INDEPENDENT_HASHES'
ENV_VERSION = 'GENERATOR3_VERSION'
ENV_REQUIRED_GEN_VERSION_FILE = 'GENERATOR3_REQUIRED_GEN_VERSION_FILE'
FAILED_VERSION_STAMP_PREFIX = '.failed__'
FAILED_VERSION_STAMP_PREFIX = '.failed__'
@@ -1,4 +1,3 @@
import errno
import logging
import os
import subprocess
@@ -10,12 +9,10 @@ import generator3
import six
from pycharm_generator_utils.constants import (
ENV_TEST_MODE_FLAG,
ENV_CONTENT_INDEPENDENT_HASHES_FLAG,
ENV_VERSION,
ENV_REQUIRED_GEN_VERSION_FILE,
)
from pycharm_generator_utils.test import GeneratorTestCase
from pycharm_generator_utils.util_methods import ignored_os_errors
logging.basicConfig(level=logging.DEBUG)
@@ -34,7 +31,6 @@ class SkeletonCachingTest(GeneratorTestCase):
return os.path.join(self.test_data_dir, rel_path)
def run_generator(self, mod_qname, mod_path=None,
fake_hashes=False,
extra_syspath_entry=None,
gen_version=None,
required_gen_version_file_path=None):
@@ -50,8 +46,6 @@ class SkeletonCachingTest(GeneratorTestCase):
ENV_TEST_MODE_FLAG: 'True',
ENV_VERSION: gen_version or TEST_GENERATOR_VERSION,
}
if fake_hashes:
env[ENV_CONTENT_INDEPENDENT_HASHES_FLAG] = 'True'
if required_gen_version_file_path:
env[ENV_REQUIRED_GEN_VERSION_FILE] = required_gen_version_file_path
@@ -169,7 +163,7 @@ class SkeletonCachingTest(GeneratorTestCase):
@unittest.skipIf(not _run_generator_in_separate_process,
'Importing module causing SIGSEGV cannot be done in the same interpreter')
def test_segmentation_fault_handling(self):
self.check_generator_output('sigsegv', mod_path='sigsegv.py', gen_version='0.1', fake_hashes=False)
self.check_generator_output('sigsegv', mod_path='sigsegv.py', gen_version='0.1')
def test_cache_not_updated_when_sdk_skeleton_is_up_to_date(self):
# We can't safely updated cache from SDK skeletons (backwards) because of binaries declaring