Best Python code snippet using tox_python
versioninfo.py
Source:versioninfo.py
...22 linuxdist = distro.linux_distribution();23 except ImportError:24 linuxdist = None;25python_info = {'python_branch': platform.python_branch(), 'python_build': platform.python_build(), 'python_compiler': platform.python_compiler(), 'python_implementation': platform.python_implementation(), 'python_revision': platform.python_revision(), 'python_version': platform.python_version(), 'python_version_tuple': platform.python_version_tuple(), 'release': platform.release(), 'system': platform.system(), 'uname': platform.uname(), 'architecture': platform.architecture(), 'machine': platform.machine(), 'node': platform.node(), 'platform': platform.platform(), 'processor': platform.processor(), 'version': platform.version(), 'java_ver': platform.java_ver(), 'win32_ver': platform.win32_ver(), 'mac_ver': platform.mac_ver(), 'linux_distribution': linuxdist, 'libc_ver': platform.libc_ver()};26def get_python_info(infotype=None):27 global python_info;28 python_info = python_info;29 if(infotype is None):30 return python_info;31 if(infotype is not None):32 return python_info.get(infotype, python_info);33getcuryear = datetime.date.today().year;34if(getcuryear <= 2015):35 getcuryear = 2016;36getcuryear = str(getcuryear);37__author__ = "Kazuki Przyborowski";38__copyright__ = "(C) Game Maker 2k @ 2015-"+getcuryear;39__credits__ = ["Kazuki Przyborowski", "Game Maker 2k"];40__copyright_year__ = "2015-"+getcuryear;41__license__ = "Revised BSD License";42__license_string__ = """-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-43 Revised BSD License44Copyright (C) 2011-2020 Game Maker 2k. 45All rights reserved.46Redistribution and use in source and binary forms, with or without47modification, are permitted provided that the following conditions are met:48 1. Redistributions of source code must retain the above copyright notice,49 this list of conditions and the following disclaimer.50 2. Redistributions in binary form must reproduce the above copyright 51 notice, this list of conditions and the following disclaimer in 52 the documentation and/or other materials provided with the distribution.53 3. Neither the name of Game Maker 2k nor the names of its contributors54 may be used to endorse or promote products derived from this software55 without specific prior written permission.56THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 57AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 59ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 60LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66THE POSSIBILITY OF SUCH DAMAGE.67The views and conclusions contained in the software and documentation are those of the68authors and should not be interpreted as representing official policies, either expressed69or implied, of Game Maker 2k.70-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-""";71__maintainer__ = "Kazuki Przyborowski";72__email__ = "kazuki.przyborowski@gmail.com";73__status__ = "Production";74__program_name__ = "PyHockeyStats";75__program_alt_name__ = "PyHockeyData";76__project__ = __program_name__;77__project_url__ = "https://github.com/GameMaker2k/Neo-Hockey-Test";78__project_release_url__ = "https://github.com/GameMaker2k/Neo-Hockey-Test/releases/latest";79__version_info__ = (0, 6, 0, "RC 1", 1);80__build_time__ = {"timestamp": None, "year": None, "month": None, "day": None, "hour": None, "minute": None, "second": None};81__build_time_utc__ = {"timestamp": None, "year": None, "month": None, "day": None, "hour": None, "minute": None, "second": None};82__build_python_info__ = {"python_branch": None, "python_build": None, "python_compiler": None, "python_implementation": None, "python_revision": None, "python_version": None, "python_version_tuple": None, "release": None, "system": None, "uname": None, "machine": None, "node": None, "platform": None, "processor": None, "version": None, "java_ver": None, "win32_ver": None, "mac_ver": None, "linux_distribution": None, "libc_ver": None};83__build_python_is_set__ = False;84if(not __build_python_is_set__):85 __build_python_info__ = python_info;86def get_build_python_info(infotype=None):87 global __build_python_info__;88 python_info = __build_python_info__;89 if(infotype is None):90 return python_info;91 if(infotype is not None):92 return python_info.get(infotype, python_info);93__revision__ = __version_info__[3];94__revision_id__ = "$Id$";95if(__version_info__[3] is not None):96 __version__ = "{major}.{minor}.{build} {release}".format(major=__version_info__[0], minor=__version_info__[1], build=__version_info__[2], release=__version_info__[3]);97if(__version_info__[3] is None):98 __version__ = "{major}.{minor}.{build}".format(major=__version_info__[0], minor=__version_info__[1], build=__version_info__[2]);99__version_alt__ = "{major}.{minor}.{build}".format(major=__version_info__[0], minor=__version_info__[1], build=__version_info__[2]);100def version_info():...
pythonvalidator_test.py
Source:pythonvalidator_test.py
...8 validator = PythonInfoValidator(expected_ver=expected_version())9 python_info = python_info_with()10 result = validator.validate(python_info, ctx=test_context())11 self.assertEqual(result.status, Status.OK)12 def test_missing_python_info(self):13 validator = PythonInfoValidator(expected_ver=expected_version())14 result = validator.validate(None, ctx=test_context())15 self.assertEqual(result.status, Status.NOT_FOUND)16 def test_validate_patch_version_diff(self):17 validator = PythonInfoValidator(expected_ver=expected_version())18 python_info = python_info_with(patch="1")19 result = validator.validate(python_info, ctx=test_context())20 self.assertEqual(result.status, Status.OK)21 def test_validate_minor_version_diff(self):22 validator = PythonInfoValidator(expected_ver=expected_version())23 python_info = python_info_with(minor="12")24 result = validator.validate(python_info, ctx=test_context())25 self.assertEqual(result.status, Status.OK)26 def test_validate_incompatible_minor_version(self):...
pythonstrictvalidator_test.py
Source:pythonstrictvalidator_test.py
...8 validator = PythonInfoStrictValidator(expected_ver=expected_version())9 python_info = python_info_with()10 result = validator.validate(python_info, ctx=test_context())11 self.assertEqual(Status.OK, result.status)12 def test_missing_python_info(self):13 validator = PythonInfoStrictValidator(expected_ver=expected_version())14 result = validator.validate(None, ctx=test_context())15 self.assertEqual(Status.NOT_FOUND, result.status)16 def test_validate_patch_version_diff(self):17 validator = PythonInfoStrictValidator(expected_ver=expected_version())18 python_info = python_info_with(patch="1")19 result = validator.validate(python_info, ctx=test_context())20 self.assertEqual(Status.NOT_FOUND, result.status)21 def test_validate_minor_version_diff(self):22 validator = PythonInfoStrictValidator(expected_ver=expected_version())23 python_info = python_info_with(minor="12")24 result = validator.validate(python_info, ctx=test_context())25 self.assertEqual(Status.NOT_FOUND, result.status)26 def test_validate_major_version_diff(self):...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!