From 96174f9a0f6d07663080ae4639b8b9b958a29761 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Tue, 26 Feb 2019 18:16:55 +0300 Subject: [PATCH] Remove computing of artificial hashes for binaries in test mode GitOrigin-RevId: 7d3f61e173ded71f922bd64022397dadceda2281 --- python/helpers/generator3.py | 9 +-------- python/helpers/pycharm_generator_utils/constants.py | 3 +-- .../pycharm_generator_utils/test/test_generation.py | 8 +------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/python/helpers/generator3.py b/python/helpers/generator3.py index e1935a861292..3837cbb64c14 100644 --- a/python/helpers/generator3.py +++ b/python/helpers/generator3.py @@ -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) diff --git a/python/helpers/pycharm_generator_utils/constants.py b/python/helpers/pycharm_generator_utils/constants.py index f58244e53f78..d480bb3da81a 100644 --- a/python/helpers/pycharm_generator_utils/constants.py +++ b/python/helpers/pycharm_generator_utils/constants.py @@ -810,7 +810,6 @@ REQUIRED_VERSION_LINE = re.compile(r'(?P\S+)\s+(?P\d+\.\d+)') BLACKLIST_VERSION_LINE = re.compile(r'(?P[^=]+) = (?P\d+\.\d+) (?P\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__' \ No newline at end of file +FAILED_VERSION_STAMP_PREFIX = '.failed__' diff --git a/python/helpers/pycharm_generator_utils/test/test_generation.py b/python/helpers/pycharm_generator_utils/test/test_generation.py index 43593b9acb68..92f356541dd2 100644 --- a/python/helpers/pycharm_generator_utils/test/test_generation.py +++ b/python/helpers/pycharm_generator_utils/test/test_generation.py @@ -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