Python py.__version__() Examples
The following are 14
code examples of py.__version__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
py
, or try the search function
.
Example #1
Source File: helpconfig.py From python-netsurv with MIT License | 6 votes |
def pytest_report_header(config): lines = [] if config.option.debug or config.option.traceconfig: lines.append( "using: pytest-{} pylib-{}".format(pytest.__version__, py.__version__) ) verinfo = getpluginversioninfo(config) if verinfo: lines.extend(verinfo) if config.option.traceconfig: lines.append("active plugins:") items = config.pluginmanager.list_name_plugin() for name, plugin in items: if hasattr(plugin, "__file__"): r = plugin.__file__ else: r = repr(plugin) lines.append(" {:<20}: {}".format(name, r)) return lines
Example #2
Source File: terminal.py From python-netsurv with MIT License | 6 votes |
def pytest_sessionstart(self, session): self._session = session self._sessionstarttime = time.time() if not self.showheader: return self.write_sep("=", "test session starts", bold=True) verinfo = platform.python_version() msg = "platform {} -- Python {}".format(sys.platform, verinfo) if hasattr(sys, "pypy_version_info"): verinfo = ".".join(map(str, sys.pypy_version_info[:3])) msg += "[pypy-{}-{}]".format(verinfo, sys.pypy_version_info[3]) msg += ", pytest-{}, py-{}, pluggy-{}".format( pytest.__version__, py.__version__, pluggy.__version__ ) if ( self.verbosity > 0 or self.config.option.debug or getattr(self.config.option, "pastebin", None) ): msg += " -- " + str(sys.executable) self.write_line(msg) lines = self.config.hook.pytest_report_header( config=self.config, startdir=self.startdir ) self._write_report_lines_from_hooks(lines)
Example #3
Source File: helpconfig.py From python-netsurv with MIT License | 6 votes |
def pytest_report_header(config): lines = [] if config.option.debug or config.option.traceconfig: lines.append( "using: pytest-{} pylib-{}".format(pytest.__version__, py.__version__) ) verinfo = getpluginversioninfo(config) if verinfo: lines.extend(verinfo) if config.option.traceconfig: lines.append("active plugins:") items = config.pluginmanager.list_name_plugin() for name, plugin in items: if hasattr(plugin, "__file__"): r = plugin.__file__ else: r = repr(plugin) lines.append(" {:<20}: {}".format(name, r)) return lines
Example #4
Source File: terminal.py From python-netsurv with MIT License | 6 votes |
def pytest_sessionstart(self, session): self._session = session self._sessionstarttime = time.time() if not self.showheader: return self.write_sep("=", "test session starts", bold=True) verinfo = platform.python_version() msg = "platform {} -- Python {}".format(sys.platform, verinfo) if hasattr(sys, "pypy_version_info"): verinfo = ".".join(map(str, sys.pypy_version_info[:3])) msg += "[pypy-{}-{}]".format(verinfo, sys.pypy_version_info[3]) msg += ", pytest-{}, py-{}, pluggy-{}".format( pytest.__version__, py.__version__, pluggy.__version__ ) if ( self.verbosity > 0 or self.config.option.debug or getattr(self.config.option, "pastebin", None) ): msg += " -- " + str(sys.executable) self.write_line(msg) lines = self.config.hook.pytest_report_header( config=self.config, startdir=self.startdir ) self._write_report_lines_from_hooks(lines)
Example #5
Source File: helpconfig.py From pytest with MIT License | 6 votes |
def pytest_report_header(config: Config) -> List[str]: lines = [] if config.option.debug or config.option.traceconfig: lines.append( "using: pytest-{} pylib-{}".format(pytest.__version__, py.__version__) ) verinfo = getpluginversioninfo(config) if verinfo: lines.extend(verinfo) if config.option.traceconfig: lines.append("active plugins:") items = config.pluginmanager.list_name_plugin() for name, plugin in items: if hasattr(plugin, "__file__"): r = plugin.__file__ else: r = repr(plugin) lines.append(" {:<20}: {}".format(name, r)) return lines
Example #6
Source File: helpconfig.py From python-netsurv with MIT License | 5 votes |
def pytest_cmdline_parse(): outcome = yield config = outcome.get_result() if config.option.debug: path = os.path.abspath("pytestdebug.log") debugfile = open(path, "w") debugfile.write( "versions pytest-%s, py-%s, " "python-%s\ncwd=%s\nargs=%s\n\n" % ( pytest.__version__, py.__version__, ".".join(map(str, sys.version_info)), os.getcwd(), config._origargs, ) ) config.trace.root.setwriter(debugfile.write) undo_tracing = config.pluginmanager.enable_tracing() sys.stderr.write("writing pytestdebug information to %s\n" % path) def unset_tracing(): debugfile.close() sys.stderr.write("wrote pytestdebug information to %s\n" % debugfile.name) config.trace.root.setwriter(None) undo_tracing() config.add_cleanup(unset_tracing)
Example #7
Source File: helpconfig.py From python-netsurv with MIT License | 5 votes |
def showversion(config): p = py.path.local(pytest.__file__) sys.stderr.write( "This is pytest version {}, imported from {}\n".format(pytest.__version__, p) ) plugininfo = getpluginversioninfo(config) if plugininfo: for line in plugininfo: sys.stderr.write(line + "\n")
Example #8
Source File: helpconfig.py From python-netsurv with MIT License | 5 votes |
def pytest_cmdline_parse(): outcome = yield config = outcome.get_result() if config.option.debug: path = os.path.abspath("pytestdebug.log") debugfile = open(path, "w") debugfile.write( "versions pytest-%s, py-%s, " "python-%s\ncwd=%s\nargs=%s\n\n" % ( pytest.__version__, py.__version__, ".".join(map(str, sys.version_info)), os.getcwd(), config._origargs, ) ) config.trace.root.setwriter(debugfile.write) undo_tracing = config.pluginmanager.enable_tracing() sys.stderr.write("writing pytestdebug information to %s\n" % path) def unset_tracing(): debugfile.close() sys.stderr.write("wrote pytestdebug information to %s\n" % debugfile.name) config.trace.root.setwriter(None) undo_tracing() config.add_cleanup(unset_tracing)
Example #9
Source File: helpconfig.py From pytest with MIT License | 5 votes |
def pytest_cmdline_parse(): outcome = yield config = outcome.get_result() # type: Config if config.option.debug: path = os.path.abspath("pytestdebug.log") debugfile = open(path, "w") debugfile.write( "versions pytest-%s, py-%s, " "python-%s\ncwd=%s\nargs=%s\n\n" % ( pytest.__version__, py.__version__, ".".join(map(str, sys.version_info)), os.getcwd(), config.invocation_params.args, ) ) config.trace.root.setwriter(debugfile.write) undo_tracing = config.pluginmanager.enable_tracing() sys.stderr.write("writing pytestdebug information to %s\n" % path) def unset_tracing() -> None: debugfile.close() sys.stderr.write("wrote pytestdebug information to %s\n" % debugfile.name) config.trace.root.setwriter(None) undo_tracing() config.add_cleanup(unset_tracing)
Example #10
Source File: helpconfig.py From pytest with MIT License | 5 votes |
def showversion(config: Config) -> None: if config.option.version > 1: sys.stderr.write( "This is pytest version {}, imported from {}\n".format( pytest.__version__, pytest.__file__ ) ) plugininfo = getpluginversioninfo(config) if plugininfo: for line in plugininfo: sys.stderr.write(line + "\n") else: sys.stderr.write("pytest {}\n".format(pytest.__version__))
Example #11
Source File: terminal.py From pytest with MIT License | 5 votes |
def pytest_sessionstart(self, session: "Session") -> None: self._session = session self._sessionstarttime = timing.time() if not self.showheader: return self.write_sep("=", "test session starts", bold=True) verinfo = platform.python_version() if not self.no_header: msg = "platform {} -- Python {}".format(sys.platform, verinfo) pypy_version_info = getattr(sys, "pypy_version_info", None) if pypy_version_info: verinfo = ".".join(map(str, pypy_version_info[:3])) msg += "[pypy-{}-{}]".format(verinfo, pypy_version_info[3]) msg += ", pytest-{}, py-{}, pluggy-{}".format( pytest.__version__, py.__version__, pluggy.__version__ ) if ( self.verbosity > 0 or self.config.option.debug or getattr(self.config.option, "pastebin", None) ): msg += " -- " + str(sys.executable) self.write_line(msg) lines = self.config.hook.pytest_report_header( config=self.config, startdir=self.startdir ) self._write_report_lines_from_hooks(lines)
Example #12
Source File: test_terminal.py From pytest with MIT License | 5 votes |
def test_header_trailer_info(self, testdir, request): testdir.monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD") testdir.makepyfile( """ def test_passes(): pass """ ) result = testdir.runpytest() verinfo = ".".join(map(str, sys.version_info[:3])) result.stdout.fnmatch_lines( [ "*===== test session starts ====*", "platform %s -- Python %s*pytest-%s*py-%s*pluggy-%s" % ( sys.platform, verinfo, pytest.__version__, py.__version__, pluggy.__version__, ), "*test_header_trailer_info.py .*", "=* 1 passed*in *.[0-9][0-9]s *=", ] ) if request.config.pluginmanager.list_plugin_distinfo(): result.stdout.fnmatch_lines(["plugins: *"])
Example #13
Source File: test_pytest_cov.py From pytest-cov with MIT License | 5 votes |
def test_dist_missing_data(testdir): """Test failure when using a worker without pytest-cov installed.""" venv_path = os.path.join(str(testdir.tmpdir), 'venv') virtualenv.cli_run([venv_path]) if sys.platform == 'win32': if platform.python_implementation() == "PyPy": exe = os.path.join(venv_path, 'bin', 'python.exe') else: exe = os.path.join(venv_path, 'Scripts', 'python.exe') else: exe = os.path.join(venv_path, 'bin', 'python') subprocess.check_call([ exe, '-mpip', 'install', 'py==%s' % py.__version__, 'pytest==%s' % pytest.__version__, 'pytest_xdist==%s' % xdist.__version__ ]) script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', '--assert=plain', '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=popen//python=%s' % exe, max_worker_restart_0, script) result.stdout.fnmatch_lines([ 'The following workers failed to return coverage data, ensure that pytest-cov is installed on these workers.' ])
Example #14
Source File: requirements.py From suds with GNU Lesser General Public License v3.0 | 5 votes |
def check_Python24_pytest_requirements(): """ Check pytest requirements in the current Python 2.4.x environment. Installing pytest into a Python 2.4.x environment requires specific py & pytest package versions. This function checks whether the environment has such compatible Python environments installed. Returns a 2-tuple (have_pytest, have_py) indicating whether valid pytest & py library packages have been detected in the current Python 2.4.x environment. If the pytest package has not been detected, the py library package will not be checked and the have_py value will be set to None. See the module docstring for more detailed information. """ assert sys.version_info[:2] == (2, 4) try: from pytest import __version__ as pytest_version except ImportError: return False, None # no pytest pv_from = parse_version(_first_supported_pytest_version) pv_to = parse_version(_first_unsupported_pytest_version_on_Python_24) if not (pv_from <= parse_version(pytest_version) < pv_to): return False, None # incompatible pytest version try: from py import __version__ as py_version except ImportError: return True, False # no py library package pv_unsupported = parse_version(_first_unsupported_py_version_on_Python_24) if parse_version(py_version) >= pv_unsupported: return True, False # incompatible py library package version return True, True