How to use has_version method in tempest

Best Python code snippet using tempest_python

test_simple.py

Source:test_simple.py Github

copy

Full Screen

1# Copyright 2011-2018 Gentoo Foundation2# Distributed under the terms of the GNU General Public License v23import subprocess4import sys5import portage6from portage import os7from portage import _unicode_decode8from portage.const import (BASH_BINARY, PORTAGE_BASE_PATH,9 PORTAGE_PYM_PATH, USER_CONFIG_PATH)10from portage.process import find_binary11from portage.tests import TestCase12from portage.tests.resolver.ResolverPlayground import ResolverPlayground13from portage.util import (ensure_dirs, find_updated_config_files,14 shlex_split)15class SimpleEmergeTestCase(TestCase):16 def _have_python_xml(self):17 try:18 __import__("xml.etree.ElementTree")19 __import__("xml.parsers.expat").parsers.expat.ExpatError20 except (AttributeError, ImportError):21 return False22 return True23 def testSimple(self):24 debug = False25 install_something = """26S="${WORKDIR}"27pkg_pretend() {28 einfo "called pkg_pretend for $CATEGORY/$PF"29}30src_install() {31 einfo "installing something..."32 insinto /usr/lib/${P}33 echo "blah blah blah" > "${T}"/regular-file34 doins "${T}"/regular-file35 dosym regular-file /usr/lib/${P}/symlink || die36 # Test CONFIG_PROTECT37 insinto /etc38 newins "${T}"/regular-file ${PN}-${SLOT%/*}39 # Test code for bug #381629, using a copyright symbol encoded with latin-1.40 # We use $(printf "\\xa9") rather than $'\\xa9', since printf apparently41 # works in any case, while $'\\xa9' transforms to \\xef\\xbf\\xbd under42 # some conditions. TODO: Find out why it transforms to \\xef\\xbf\\xbd when43 # running tests for Python 3.2 (even though it's bash that is ultimately44 # responsible for performing the transformation).45 local latin_1_dir=/usr/lib/${P}/latin-1-$(printf "\\xa9")-directory46 insinto "${latin_1_dir}"47 echo "blah blah blah" > "${T}"/latin-1-$(printf "\\xa9")-regular-file || die48 doins "${T}"/latin-1-$(printf "\\xa9")-regular-file49 dosym latin-1-$(printf "\\xa9")-regular-file ${latin_1_dir}/latin-1-$(printf "\\xa9")-symlink || die50 call_has_and_best_version51}52pkg_config() {53 einfo "called pkg_config for $CATEGORY/$PF"54}55pkg_info() {56 einfo "called pkg_info for $CATEGORY/$PF"57}58pkg_preinst() {59 if ! ___eapi_best_version_and_has_version_support_-b_-d_-r; then60 # The BROOT variable is unset during pkg_* phases for EAPI 7,61 # therefore best/has_version -b is expected to fail if we attempt62 # to call it for EAPI 7 here.63 call_has_and_best_version64 fi65}66call_has_and_best_version() {67 local root_arg68 if ___eapi_best_version_and_has_version_support_-b_-d_-r; then69 root_arg="-b"70 else71 root_arg="--host-root"72 fi73 einfo "called ${EBUILD_PHASE_FUNC} for $CATEGORY/$PF"74 einfo "EPREFIX=${EPREFIX}"75 einfo "PORTAGE_OVERRIDE_EPREFIX=${PORTAGE_OVERRIDE_EPREFIX}"76 einfo "ROOT=${ROOT}"77 einfo "EROOT=${EROOT}"78 einfo "SYSROOT=${SYSROOT}"79 einfo "ESYSROOT=${ESYSROOT}"80 einfo "BROOT=${BROOT}"81 # Test that has_version and best_version work correctly with82 # prefix (involves internal ROOT -> EROOT calculation in order83 # to support ROOT override via the environment with EAPIs 384 # and later which support prefix).85 if has_version $CATEGORY/$PN:$SLOT ; then86 einfo "has_version detects an installed instance of $CATEGORY/$PN:$SLOT"87 einfo "best_version reports that the installed instance is $(best_version $CATEGORY/$PN:$SLOT)"88 else89 einfo "has_version does not detect an installed instance of $CATEGORY/$PN:$SLOT"90 fi91 if [[ ${EPREFIX} != ${PORTAGE_OVERRIDE_EPREFIX} ]] ; then92 if has_version ${root_arg} $CATEGORY/$PN:$SLOT ; then93 einfo "has_version ${root_arg} detects an installed instance of $CATEGORY/$PN:$SLOT"94 einfo "best_version ${root_arg} reports that the installed instance is $(best_version ${root_arg} $CATEGORY/$PN:$SLOT)"95 else96 einfo "has_version ${root_arg} does not detect an installed instance of $CATEGORY/$PN:$SLOT"97 fi98 fi99}100"""101 ebuilds = {102 "dev-libs/A-1": {103 "EAPI" : "5",104 "IUSE" : "+flag",105 "KEYWORDS": "x86",106 "LICENSE": "GPL-2",107 "MISC_CONTENT": install_something,108 "RDEPEND": "flag? ( dev-libs/B[flag] )",109 },110 "dev-libs/B-1": {111 "EAPI" : "5",112 "IUSE" : "+flag",113 "KEYWORDS": "x86",114 "LICENSE": "GPL-2",115 "MISC_CONTENT": install_something,116 },117 "dev-libs/C-1": {118 "EAPI" : "7",119 "KEYWORDS": "~x86",120 "RDEPEND": "dev-libs/D[flag]",121 "MISC_CONTENT": install_something,122 },123 "dev-libs/D-1": {124 "EAPI" : "7",125 "KEYWORDS": "~x86",126 "IUSE" : "flag",127 "MISC_CONTENT": install_something,128 },129 "virtual/foo-0": {130 "EAPI" : "5",131 "KEYWORDS": "x86",132 "LICENSE": "GPL-2",133 },134 }135 installed = {136 "dev-libs/A-1": {137 "EAPI" : "5",138 "IUSE" : "+flag",139 "KEYWORDS": "x86",140 "LICENSE": "GPL-2",141 "RDEPEND": "flag? ( dev-libs/B[flag] )",142 "USE": "flag",143 },144 "dev-libs/B-1": {145 "EAPI" : "5",146 "IUSE" : "+flag",147 "KEYWORDS": "x86",148 "LICENSE": "GPL-2",149 "USE": "flag",150 },151 "dev-libs/depclean-me-1": {152 "EAPI" : "5",153 "IUSE" : "",154 "KEYWORDS": "x86",155 "LICENSE": "GPL-2",156 "USE": "",157 },158 "app-misc/depclean-me-1": {159 "EAPI" : "5",160 "IUSE" : "",161 "KEYWORDS": "x86",162 "LICENSE": "GPL-2",163 "RDEPEND": "dev-libs/depclean-me",164 "USE": "",165 },166 }167 metadata_xml_files = (168 (169 "dev-libs/A",170 {171 "flags" : "<flag name='flag'>Description of how USE='flag' affects this package</flag>",172 },173 ),174 (175 "dev-libs/B",176 {177 "flags" : "<flag name='flag'>Description of how USE='flag' affects this package</flag>",178 },179 ),180 )181 playground = ResolverPlayground(182 ebuilds=ebuilds, installed=installed, debug=debug)183 settings = playground.settings184 eprefix = settings["EPREFIX"]185 eroot = settings["EROOT"]186 trees = playground.trees187 portdb = trees[eroot]["porttree"].dbapi188 test_repo_location = settings.repositories["test_repo"].location189 var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")190 cachedir = os.path.join(var_cache_edb, "dep")191 cachedir_pregen = os.path.join(test_repo_location, "metadata", "md5-cache")192 portage_python = portage._python_interpreter193 dispatch_conf_cmd = (portage_python, "-b", "-Wd",194 os.path.join(self.sbindir, "dispatch-conf"))195 ebuild_cmd = (portage_python, "-b", "-Wd",196 os.path.join(self.bindir, "ebuild"))197 egencache_cmd = (portage_python, "-b", "-Wd",198 os.path.join(self.bindir, "egencache"),199 "--repo", "test_repo",200 "--repositories-configuration", settings.repositories.config_string())201 emerge_cmd = (portage_python, "-b", "-Wd",202 os.path.join(self.bindir, "emerge"))203 emaint_cmd = (portage_python, "-b", "-Wd",204 os.path.join(self.sbindir, "emaint"))205 env_update_cmd = (portage_python, "-b", "-Wd",206 os.path.join(self.sbindir, "env-update"))207 etc_update_cmd = (BASH_BINARY,208 os.path.join(self.sbindir, "etc-update"))209 fixpackages_cmd = (portage_python, "-b", "-Wd",210 os.path.join(self.sbindir, "fixpackages"))211 portageq_cmd = (portage_python, "-b", "-Wd",212 os.path.join(self.bindir, "portageq"))213 quickpkg_cmd = (portage_python, "-b", "-Wd",214 os.path.join(self.bindir, "quickpkg"))215 regenworld_cmd = (portage_python, "-b", "-Wd",216 os.path.join(self.sbindir, "regenworld"))217 rm_binary = find_binary("rm")218 self.assertEqual(rm_binary is None, False,219 "rm command not found")220 rm_cmd = (rm_binary,)221 egencache_extra_args = []222 if self._have_python_xml():223 egencache_extra_args.append("--update-use-local-desc")224 test_ebuild = portdb.findname("dev-libs/A-1")225 self.assertFalse(test_ebuild is None)226 cross_prefix = os.path.join(eprefix, "cross_prefix")227 cross_root = os.path.join(eprefix, "cross_root")228 cross_eroot = os.path.join(cross_root, eprefix.lstrip(os.sep))229 test_commands = (230 env_update_cmd,231 portageq_cmd + ("envvar", "-v", "CONFIG_PROTECT", "EROOT",232 "PORTAGE_CONFIGROOT", "PORTAGE_TMPDIR", "USERLAND"),233 etc_update_cmd,234 dispatch_conf_cmd,235 emerge_cmd + ("--version",),236 emerge_cmd + ("--info",),237 emerge_cmd + ("--info", "--verbose"),238 emerge_cmd + ("--list-sets",),239 emerge_cmd + ("--check-news",),240 rm_cmd + ("-rf", cachedir),241 rm_cmd + ("-rf", cachedir_pregen),242 emerge_cmd + ("--regen",),243 rm_cmd + ("-rf", cachedir),244 ({"FEATURES" : "metadata-transfer"},) + \245 emerge_cmd + ("--regen",),246 rm_cmd + ("-rf", cachedir),247 ({"FEATURES" : "metadata-transfer"},) + \248 emerge_cmd + ("--regen",),249 rm_cmd + ("-rf", cachedir),250 egencache_cmd + ("--update",) + tuple(egencache_extra_args),251 ({"FEATURES" : "metadata-transfer"},) + \252 emerge_cmd + ("--metadata",),253 rm_cmd + ("-rf", cachedir),254 ({"FEATURES" : "metadata-transfer"},) + \255 emerge_cmd + ("--metadata",),256 emerge_cmd + ("--metadata",),257 rm_cmd + ("-rf", cachedir),258 emerge_cmd + ("--oneshot", "virtual/foo"),259 lambda: self.assertFalse(os.path.exists(260 os.path.join(pkgdir, "virtual", "foo-0.tbz2"))),261 ({"FEATURES" : "unmerge-backup"},) + \262 emerge_cmd + ("--unmerge", "virtual/foo"),263 lambda: self.assertTrue(os.path.exists(264 os.path.join(pkgdir, "virtual", "foo-0.tbz2"))),265 emerge_cmd + ("--pretend", "dev-libs/A"),266 ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"),267 emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"),268 emerge_cmd + ("-p", "dev-libs/B"),269 emerge_cmd + ("-p", "--newrepo", "dev-libs/B"),270 emerge_cmd + ("-B", "dev-libs/B",),271 emerge_cmd + ("--oneshot", "--usepkg", "dev-libs/B",),272 # trigger clean prior to pkg_pretend as in bug #390711273 ebuild_cmd + (test_ebuild, "unpack"), 274 emerge_cmd + ("--oneshot", "dev-libs/A",),275 emerge_cmd + ("--noreplace", "dev-libs/A",),276 emerge_cmd + ("--config", "dev-libs/A",),277 emerge_cmd + ("--info", "dev-libs/A", "dev-libs/B"),278 emerge_cmd + ("--pretend", "--depclean", "--verbose", "dev-libs/B"),279 emerge_cmd + ("--pretend", "--depclean",),280 emerge_cmd + ("--depclean",),281 quickpkg_cmd + ("--include-config", "y", "dev-libs/A",),282 # Test bug #523684, where a file renamed or removed by the283 # admin forces replacement files to be merged with config284 # protection.285 lambda: self.assertEqual(0,286 len(list(find_updated_config_files(eroot,287 shlex_split(settings["CONFIG_PROTECT"]))))),288 lambda: os.unlink(os.path.join(eprefix, "etc", "A-0")),289 emerge_cmd + ("--usepkgonly", "dev-libs/A"),290 lambda: self.assertEqual(1,291 len(list(find_updated_config_files(eroot,292 shlex_split(settings["CONFIG_PROTECT"]))))),293 emaint_cmd + ("--check", "all"),294 emaint_cmd + ("--fix", "all"),295 fixpackages_cmd,296 regenworld_cmd,297 portageq_cmd + ("match", eroot, "dev-libs/A"),298 portageq_cmd + ("best_visible", eroot, "dev-libs/A"),299 portageq_cmd + ("best_visible", eroot, "binary", "dev-libs/A"),300 portageq_cmd + ("contents", eroot, "dev-libs/A-1"),301 portageq_cmd + ("metadata", eroot, "ebuild", "dev-libs/A-1", "EAPI", "IUSE", "RDEPEND"),302 portageq_cmd + ("metadata", eroot, "binary", "dev-libs/A-1", "EAPI", "USE", "RDEPEND"),303 portageq_cmd + ("metadata", eroot, "installed", "dev-libs/A-1", "EAPI", "USE", "RDEPEND"),304 portageq_cmd + ("owners", eroot, eroot + "usr"),305 emerge_cmd + ("-p", eroot + "usr"),306 emerge_cmd + ("-p", "--unmerge", "-q", eroot + "usr"),307 emerge_cmd + ("--unmerge", "--quiet", "dev-libs/A"),308 emerge_cmd + ("-C", "--quiet", "dev-libs/B"),309 # If EMERGE_DEFAULT_OPTS contains --autounmask=n, then --autounmask310 # must be specified with --autounmask-continue.311 ({"EMERGE_DEFAULT_OPTS" : "--autounmask=n"},) + \312 emerge_cmd + ("--autounmask", "--autounmask-continue", "dev-libs/C",),313 # Verify that the above --autounmask-continue command caused314 # USE=flag to be applied correctly to dev-libs/D.315 portageq_cmd + ("match", eroot, "dev-libs/D[flag]"),316 # Test cross-prefix usage, including chpathtool for binpkgs.317 # EAPI 7318 ({"EPREFIX" : cross_prefix},) + \319 emerge_cmd + ("dev-libs/C",),320 ({"EPREFIX" : cross_prefix},) + \321 portageq_cmd + ("has_version", cross_prefix, "dev-libs/C"),322 ({"EPREFIX" : cross_prefix},) + \323 portageq_cmd + ("has_version", cross_prefix, "dev-libs/D"),324 ({"ROOT": cross_root},) + emerge_cmd + ("dev-libs/D",),325 portageq_cmd + ("has_version", cross_eroot, "dev-libs/D"),326 # EAPI 5327 ({"EPREFIX" : cross_prefix},) + \328 emerge_cmd + ("--usepkgonly", "dev-libs/A"),329 ({"EPREFIX" : cross_prefix},) + \330 portageq_cmd + ("has_version", cross_prefix, "dev-libs/A"),331 ({"EPREFIX" : cross_prefix},) + \332 portageq_cmd + ("has_version", cross_prefix, "dev-libs/B"),333 ({"EPREFIX" : cross_prefix},) + \334 emerge_cmd + ("-C", "--quiet", "dev-libs/B"),335 ({"EPREFIX" : cross_prefix},) + \336 emerge_cmd + ("-C", "--quiet", "dev-libs/A"),337 ({"EPREFIX" : cross_prefix},) + \338 emerge_cmd + ("dev-libs/A",),339 ({"EPREFIX" : cross_prefix},) + \340 portageq_cmd + ("has_version", cross_prefix, "dev-libs/A"),341 ({"EPREFIX" : cross_prefix},) + \342 portageq_cmd + ("has_version", cross_prefix, "dev-libs/B"),343 # Test ROOT support344 ({"ROOT": cross_root},) + emerge_cmd + ("dev-libs/B",),345 portageq_cmd + ("has_version", cross_eroot, "dev-libs/B"),346 )347 distdir = playground.distdir348 pkgdir = playground.pkgdir349 fake_bin = os.path.join(eprefix, "bin")350 portage_tmpdir = os.path.join(eprefix, "var", "tmp", "portage")351 profile_path = settings.profile_path352 user_config_dir = os.path.join(os.sep, eprefix, USER_CONFIG_PATH)353 path = os.environ.get("PATH")354 if path is not None and not path.strip():355 path = None356 if path is None:357 path = ""358 else:359 path = ":" + path360 path = fake_bin + path361 pythonpath = os.environ.get("PYTHONPATH")362 if pythonpath is not None and not pythonpath.strip():363 pythonpath = None364 if pythonpath is not None and \365 pythonpath.split(":")[0] == PORTAGE_PYM_PATH:366 pass367 else:368 if pythonpath is None:369 pythonpath = ""370 else:371 pythonpath = ":" + pythonpath372 pythonpath = PORTAGE_PYM_PATH + pythonpath373 env = {374 "PORTAGE_OVERRIDE_EPREFIX" : eprefix,375 "CLEAN_DELAY" : "0",376 "DISTDIR" : distdir,377 "EMERGE_WARNING_DELAY" : "0",378 "INFODIR" : "",379 "INFOPATH" : "",380 "PATH" : path,381 "PKGDIR" : pkgdir,382 "PORTAGE_INST_GID" : str(portage.data.portage_gid),383 "PORTAGE_INST_UID" : str(portage.data.portage_uid),384 "PORTAGE_PYTHON" : portage_python,385 "PORTAGE_REPOSITORIES" : settings.repositories.config_string(),386 "PORTAGE_TMPDIR" : portage_tmpdir,387 "PORTAGE_LOGDIR" : portage_tmpdir,388 "PYTHONDONTWRITEBYTECODE" : os.environ.get("PYTHONDONTWRITEBYTECODE", ""),389 "PYTHONPATH" : pythonpath,390 "__PORTAGE_TEST_PATH_OVERRIDE" : fake_bin,391 }392 if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ:393 env["__PORTAGE_TEST_HARDLINK_LOCKS"] = \394 os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"]395 updates_dir = os.path.join(test_repo_location, "profiles", "updates")396 dirs = [cachedir, cachedir_pregen, cross_eroot, cross_prefix,397 distdir, fake_bin, portage_tmpdir, updates_dir,398 user_config_dir, var_cache_edb]399 etc_symlinks = ("dispatch-conf.conf", "etc-update.conf")400 # Override things that may be unavailable, or may have portability401 # issues when running tests in exotic environments.402 # prepstrip - bug #447810 (bash read builtin EINTR problem)403 true_symlinks = ["find", "prepstrip", "sed", "scanelf"]404 true_binary = find_binary("true")405 self.assertEqual(true_binary is None, False,406 "true command not found")407 try:408 for d in dirs:409 ensure_dirs(d)410 for x in true_symlinks:411 os.symlink(true_binary, os.path.join(fake_bin, x))412 for x in etc_symlinks:413 os.symlink(os.path.join(self.cnf_etc_path, x),414 os.path.join(eprefix, "etc", x))415 with open(os.path.join(var_cache_edb, "counter"), 'wb') as f:416 f.write(b"100")417 # non-empty system set keeps --depclean quiet418 with open(os.path.join(profile_path, "packages"), 'w') as f:419 f.write("*dev-libs/token-system-pkg")420 for cp, xml_data in metadata_xml_files:421 with open(os.path.join(test_repo_location, cp, "metadata.xml"), 'w') as f:422 f.write(playground.metadata_xml_template % xml_data)423 with open(os.path.join(updates_dir, "1Q-2010"), 'w') as f:424 f.write("""425slotmove =app-doc/pms-3 2 3426move dev-util/git dev-vcs/git427""")428 if debug:429 # The subprocess inherits both stdout and stderr, for430 # debugging purposes.431 stdout = None432 else:433 # The subprocess inherits stderr so that any warnings434 # triggered by python -Wd will be visible.435 stdout = subprocess.PIPE436 for args in test_commands:437 if hasattr(args, '__call__'):438 args()439 continue440 if isinstance(args[0], dict):441 local_env = env.copy()442 local_env.update(args[0])443 args = args[1:]444 else:445 local_env = env446 proc = subprocess.Popen(args,447 env=local_env, stdout=stdout)448 if debug:449 proc.wait()450 else:451 output = proc.stdout.readlines()452 proc.wait()453 proc.stdout.close()454 if proc.returncode != os.EX_OK:455 for line in output:456 sys.stderr.write(_unicode_decode(line))457 self.assertEqual(os.EX_OK, proc.returncode,458 "emerge failed with args %s" % (args,))459 finally:...

Full Screen

Full Screen

test_model_record.py

Source:test_model_record.py Github

copy

Full Screen

1import pytest2from model import Record3class TestModelRecord:4 @pytest.fixture5 def testRecord(self):6 return Record(7 uuid='Test UUID',8 title='Test Title',9 languages=['English|en|eng'],10 has_version='first edition'11 )12 # Test for setter method when edition is None or empty list13 def test_no_language(self, testRecord):14 testRecord.languages = None15 testRecord.has_version = 'first edition'16 assert testRecord.has_version == 'first edition|1'17 # Test to assert that the setter properly handles null values18 def test_no_edition(self, testRecord):19 testRecord.has_version = None20 assert testRecord.has_version is None21 # Failed Test for setter method22 def test_has_version_failure(self, testRecord):23 testRecord.has_version = 'other edition'24 assert testRecord.has_version == 'other edition|None'25 # Test for setter method when edition is in numeric form26 def test_has_version_numeric(self, testRecord):27 testRecord.has_version = '2nd edition'28 assert testRecord.has_version == '2nd edition|2'29 30 # Test for setter method when edition is in English31 def test_has_version_english(self, testRecord):32 testRecord.has_version = 'first edition'33 assert testRecord.has_version == 'first edition|1'34 # Test for setter method when edition is in French35 def test_has_version_french(self, testRecord):36 testRecord.languages = ['French|fr|fre']37 testRecord.has_version = 'deuxième edition'38 assert testRecord.has_version == 'deuxième edition|2'39 # Test for setter method when edition is in German40 def test_has_version_german(self, testRecord):41 testRecord.languages = ['German|ge|dt']42 testRecord.has_version = 'zweite edition'43 assert testRecord.has_version == 'zweite edition|2'44 45 # Test for setter method when edition is in Spanish46 def test_has_version_spanish(self, testRecord):47 testRecord.languages = ['Spanish|spa|span']48 testRecord.has_version = 'segundo edition'49 assert testRecord.has_version == 'segundo edition|2'50 # Test for setter method when edition is in Dutch51 def test_has_version_dutch(self, testRecord):52 testRecord.languages = ['Dutch|du|dut']53 testRecord.has_version = 'tweede edition'54 assert testRecord.has_version == 'tweede edition|2'55 56 # Test for setter method when edition is in Russian57 def test_has_version_russian(self, testRecord):58 testRecord.languages = ['Russian|ru|rus']59 testRecord.has_version = 'второй edition'...

Full Screen

Full Screen

node_versioning.py

Source:node_versioning.py Github

copy

Full Screen

...25def decode(x):26 x = from62(x) * 6027 x = datetime.datetime.fromtimestamp(x).strftime("%Y-%m-%d, %H:%M")28 return x29def has_version(name):30 if len(name) >= 8:31 format_ok = name[-6] == "#"32 alnum_ok = name[-5:].isalnum()33 date_ok = 1_600_000_000 < 60 * from62(name[-5:]) < 4_000_000_00034 has_version = format_ok and alnum_ok and date_ok35 else:36 has_version = False37 return has_version38class AX_OT_version_encode(bpy.types.Operator):39 40 bl_idname = "ax.version_encode"41 bl_label = "Encode Time"42 bl_description = "Append encoded time to the end of node group's name"43 44 @classmethod45 def poll(cls, context): # doesn't work in compositor?46 if hasattr(context, "active_node"):47 node = context.active_node48 if node:49 return hasattr(node, "node_tree")50 return False51 # is_selected = context.active_node.select52 def execute(self, context):53 active = context.active_node54 name = active.node_tree.name55 version = encode()56 if has_version(name):57 new_name = name[:-5] + version58 else:59 new_name = name + "_#" + version60 active.node_tree.name = new_name61 return {'FINISHED'}62class AX_OT_version_decode(bpy.types.Operator):63 64 bl_idname = "ax.version_decode"65 bl_label = "Decode Time"66 bl_description = "Decode the time of last marked change"67 68 @classmethod69 def poll(cls, context):70 if hasattr(context, "active_node"):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful