mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Extract @python2_only/@python3_only helper test decorators
GitOrigin-RevId: 7974c3d8abd28c5d7b576586ae76175016a9a9a8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
82da26cf88
commit
3bdc81e100
@@ -7,12 +7,17 @@ import unittest
|
||||
from contextlib import contextmanager
|
||||
from io import open
|
||||
|
||||
import six
|
||||
|
||||
from pycharm_generator_utils.constants import ENV_TEST_MODE_FLAG
|
||||
|
||||
_test_dir = os.path.dirname(__file__)
|
||||
_test_data_root_dir = os.path.join(_test_dir, 'data')
|
||||
_override_test_data = False
|
||||
|
||||
python3_only = unittest.skipUnless(six.PY3, 'Python 3 only test')
|
||||
python2_only = unittest.skipUnless(six.PY2, 'Python 2 only test')
|
||||
|
||||
|
||||
class GeneratorTestCase(unittest.TestCase):
|
||||
longMessage = True
|
||||
|
||||
@@ -5,9 +5,8 @@ import textwrap
|
||||
import unittest
|
||||
|
||||
import generator3
|
||||
import six
|
||||
from generator3 import GenerationStatus
|
||||
from generator3_tests import GeneratorTestCase
|
||||
from generator3_tests import GeneratorTestCase, python3_only, python2_only
|
||||
from pycharm_generator_utils.constants import (
|
||||
CACHE_DIR_NAME,
|
||||
ENV_REQUIRED_GEN_VERSION_FILE,
|
||||
@@ -251,11 +250,11 @@ class SkeletonCachingTest(GeneratorTestCase):
|
||||
def test_cache_skeleton_regenerated_when_sdk_skeleton_generation_failed_for_modified_binary(self):
|
||||
self.check_generator_output('mod', mod_path='mod.py', gen_version='0.1', custom_required_gen=True)
|
||||
|
||||
@unittest.skipUnless(six.PY3, "Python 3 version of the test")
|
||||
@python3_only
|
||||
def test_inaccessible_class_attribute_py3(self):
|
||||
self.check_generator_output('mod', mod_path='mod.py', success=False)
|
||||
|
||||
@unittest.skipUnless(six.PY2, "Python 2 version of the test")
|
||||
@python2_only
|
||||
def test_inaccessible_class_attribute_py2(self):
|
||||
self.check_generator_output('mod', mod_path='mod.py', success=False)
|
||||
|
||||
@@ -304,14 +303,14 @@ class SkeletonCachingTest(GeneratorTestCase):
|
||||
self.assertTrue(os.path.exists(os.path.join(self.temp_skeletons_dir, 'pyexpat', 'model.py')))
|
||||
self.assertTrue(os.path.exists(os.path.join(self.temp_skeletons_dir, 'pyexpat', 'errors.py')))
|
||||
|
||||
@unittest.skipUnless(six.PY3, 'Python 3 only test')
|
||||
@python3_only
|
||||
def test_introspecting_submodule_modifies_sys_modules(self):
|
||||
self.check_generator_output('mod', 'mod.py')
|
||||
|
||||
# PY-37241
|
||||
# Python 2 version of the skeleton differs significantly
|
||||
# TODO investigate why
|
||||
@unittest.skipUnless(six.PY3, 'Python 3 only test')
|
||||
@python3_only
|
||||
def test_non_string_dunder_module(self):
|
||||
self.check_generator_output('mod', 'mod.py')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user